2020-08-30 17:03:26 -07:00
|
|
|
#include "Block.h"
|
|
|
|
|
|
|
|
|
|
|
2021-02-25 16:53:22 +01:00
|
|
|
#include "bscript/compiler/ast/NodeVisitor.h"
|
2020-08-30 17:03:26 -07:00
|
|
|
|
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
|
|
|
{
|
|
|
|
|
Block::Block( const SourceLocation& source_location,
|
|
|
|
|
std::vector<std::unique_ptr<Statement>> statements )
|
2020-09-12 09:31:52 -07:00
|
|
|
: Statement( source_location )
|
2020-08-30 17:03:26 -07:00
|
|
|
{
|
|
|
|
|
children.reserve( statements.size() );
|
|
|
|
|
for ( auto& statement : statements )
|
|
|
|
|
{
|
|
|
|
|
children.push_back( std::move( statement ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Block::accept( NodeVisitor& visitor )
|
|
|
|
|
{
|
|
|
|
|
visitor.visit_block( *this );
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 06:51:44 +01:00
|
|
|
void Block::describe_to( std::string& w ) const
|
2020-08-30 17:03:26 -07:00
|
|
|
{
|
2024-01-12 06:51:44 +01:00
|
|
|
w += "block";
|
2020-08-30 17:03:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Pol::Bscript::Compiler
|