2020-08-30 17:03:26 -07:00
|
|
|
#include "Block.h"
|
|
|
|
|
|
|
|
|
|
#include <format/format.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 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Block::describe_to( fmt::Writer& w ) const
|
|
|
|
|
{
|
|
|
|
|
w << "block";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Pol::Bscript::Compiler
|