2020-09-28 08:11:10 -07:00
|
|
|
#include "VariableAssignmentStatement.h"
|
|
|
|
|
|
|
|
|
|
|
2021-02-25 16:53:22 +01:00
|
|
|
#include "bscript/compiler/ast/Identifier.h"
|
|
|
|
|
#include "bscript/compiler/ast/NodeVisitor.h"
|
2020-09-28 08:11:10 -07:00
|
|
|
|
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
|
|
|
{
|
|
|
|
|
VariableAssignmentStatement::VariableAssignmentStatement( const SourceLocation& source_location,
|
|
|
|
|
std::unique_ptr<Identifier> identifier,
|
|
|
|
|
std::unique_ptr<Node> rhs )
|
|
|
|
|
: Statement( source_location )
|
|
|
|
|
{
|
|
|
|
|
children.reserve( 2 );
|
|
|
|
|
children.push_back( std::move( identifier ) );
|
|
|
|
|
children.push_back( std::move( rhs ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VariableAssignmentStatement::accept( NodeVisitor& visitor )
|
|
|
|
|
{
|
|
|
|
|
visitor.visit_variable_assignment_statement( *this );
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 06:51:44 +01:00
|
|
|
void VariableAssignmentStatement::describe_to( std::string& w ) const
|
2020-09-28 08:11:10 -07:00
|
|
|
{
|
2024-01-12 06:51:44 +01:00
|
|
|
w += "variable-assignment-statement";
|
2020-09-28 08:11:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Identifier& VariableAssignmentStatement::identifier()
|
|
|
|
|
{
|
|
|
|
|
return child<Identifier>( 0 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Node& VariableAssignmentStatement::rhs()
|
|
|
|
|
{
|
|
|
|
|
return child<Node>( 1 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Pol::Bscript::Compiler
|