2026-07-25 23:01:18 +02:00
|
|
|
#include "bscript/compiler/ast/Identifier.h"
|
2020-08-25 00:57:03 -07:00
|
|
|
|
|
|
|
|
|
2021-02-25 16:53:22 +01:00
|
|
|
#include "bscript/compiler/ast/NodeVisitor.h"
|
2020-08-25 00:57:03 -07:00
|
|
|
|
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
|
|
|
{
|
2024-08-11 23:01:38 +02:00
|
|
|
Identifier::Identifier( const SourceLocation& loc, const ScopableName& scoped_name )
|
|
|
|
|
: Expression( loc ), scoped_name( scoped_name )
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
Identifier::Identifier( const SourceLocation& loc, const std::string& name )
|
|
|
|
|
: Identifier( loc, ScopableName( ScopeName::None, name ) )
|
2020-08-25 00:57:03 -07:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Identifier::accept( NodeVisitor& visitor )
|
|
|
|
|
{
|
|
|
|
|
visitor.visit_identifier( *this );
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 06:51:44 +01:00
|
|
|
void Identifier::describe_to( std::string& w ) const
|
2020-08-25 00:57:03 -07:00
|
|
|
{
|
2024-08-11 23:01:38 +02:00
|
|
|
fmt::format_to( std::back_inserter( w ), "identifier({})", scoped_name.string() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string Identifier::string() const
|
|
|
|
|
{
|
|
|
|
|
return scoped_name.string();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const std::string& Identifier::name() const
|
|
|
|
|
{
|
|
|
|
|
return scoped_name.name;
|
2020-08-25 00:57:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Pol::Bscript::Compiler
|