2026-07-25 23:01:18 +02:00
|
|
|
#include "bscript/compiler/ast/ConstDeclaration.h"
|
2020-09-01 00:54:24 -07:00
|
|
|
|
2024-01-16 17:55:42 +01:00
|
|
|
|
2020-09-01 00:54:24 -07:00
|
|
|
#include <utility>
|
|
|
|
|
|
2021-02-25 16:53:22 +01:00
|
|
|
#include "bscript/compiler/ast/Expression.h"
|
|
|
|
|
#include "bscript/compiler/ast/NodeVisitor.h"
|
2020-09-01 00:54:24 -07:00
|
|
|
|
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
|
|
|
{
|
2025-08-19 09:07:02 +02:00
|
|
|
ConstDeclaration::ConstDeclaration( const SourceLocation& source_location, ScopableName name,
|
2020-09-01 00:54:24 -07:00
|
|
|
std::unique_ptr<Expression> expression,
|
|
|
|
|
bool ignore_overwrite_attempt )
|
|
|
|
|
: Node( source_location, std::move( expression ) ),
|
2025-08-19 09:07:02 +02:00
|
|
|
name( std::move( name ) ),
|
2020-09-01 00:54:24 -07:00
|
|
|
ignore_overwrite_attempt( ignore_overwrite_attempt )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Expression& ConstDeclaration::expression()
|
|
|
|
|
{
|
|
|
|
|
return child<Expression>( 0 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ConstDeclaration::accept( NodeVisitor& visitor )
|
|
|
|
|
{
|
|
|
|
|
visitor.visit_const_declaration( *this );
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 06:51:44 +01:00
|
|
|
void ConstDeclaration::describe_to( std::string& w ) const
|
2020-09-01 00:54:24 -07:00
|
|
|
{
|
2025-08-19 09:07:02 +02:00
|
|
|
fmt::format_to( std::back_inserter( w ), "const-declaration({})", name.string() );
|
2020-09-01 00:54:24 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Pol::Bscript::Compiler
|