polserver/pol-core/bscript/compiler/ast/FunctionBody.cpp

30 lines
740 B
C++
Raw Permalink Normal View History

#include "bscript/compiler/ast/FunctionBody.h"
#include "bscript/compiler/ast/NodeVisitor.h"
#include "bscript/compiler/ast/Statement.h"
namespace Pol::Bscript::Compiler
{
FunctionBody::FunctionBody( const SourceLocation& source_location,
std::vector<std::unique_ptr<Statement>> statements )
: Node( source_location, std::move( statements ) )
{
}
void FunctionBody::accept( NodeVisitor& visitor )
{
visitor.visit_function_body( *this );
}
void FunctionBody::describe_to( std::string& w ) const
{
w += "user-function-body";
}
Statement* FunctionBody::last_statement()
{
return children.empty() ? nullptr : static_cast<Statement*>( children.back().get() );
}
} // namespace Pol::Bscript::Compiler