#include "UserFunction.h" #include #include #include "bscript/compiler/ast/FunctionBody.h" #include "bscript/compiler/ast/FunctionParameterList.h" #include "bscript/compiler/ast/NodeVisitor.h" namespace Pol::Bscript::Compiler { UserFunction::UserFunction( const SourceLocation& source_location, bool exported, std::string name, std::unique_ptr parameter_list, std::unique_ptr body, const SourceLocation& endfunction_location ) : Function( source_location, std::move( name ), std::move( parameter_list ), std::move( body ) ), exported( exported ), endfunction_location( endfunction_location ) { } void UserFunction::accept( NodeVisitor& visitor ) { visitor.visit_user_function( *this ); } void UserFunction::describe_to( fmt::Writer& w ) const { w << "user-function(" << name << ")"; } FunctionBody& UserFunction::body() { return child( 1 ); } } // namespace Pol::Bscript::Compiler