mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
Adds enough to build the AST nodes for the module function declarations in a .em file. Adds: - Function: base class for module function declarations and user functions - FunctionParameterDeclaration: declaration for a function parameter, as well as its default value if any - FunctionParameterList: just a holder for function parameter declarations - ModuleFunctionDeclaration: for function declarations in .em files - FunctionResolver: hooks up function calls to module functions or user functions - ModuleProcessor: a visitor for processing const declarations and module function declarations (const declarations are yet to come from the main branch)
30 lines
909 B
C++
30 lines
909 B
C++
#include "ModuleFunctionDeclaration.h"
|
|
|
|
#include <format/format.h>
|
|
#include <utility>
|
|
|
|
#include "compiler/ast/FunctionParameterDeclaration.h"
|
|
#include "compiler/ast/FunctionParameterList.h"
|
|
#include "compiler/ast/NodeVisitor.h"
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
{
|
|
ModuleFunctionDeclaration::ModuleFunctionDeclaration(
|
|
const SourceLocation& source_location, std::string module_name, std::string name,
|
|
std::unique_ptr<FunctionParameterList> parameter_list )
|
|
: Function( source_location, std::move( name ), std::move( parameter_list ) ),
|
|
module_name( std::move( module_name ) )
|
|
{
|
|
}
|
|
|
|
void ModuleFunctionDeclaration::accept( NodeVisitor& visitor )
|
|
{
|
|
visitor.visit_module_function_declaration( *this );
|
|
}
|
|
|
|
void ModuleFunctionDeclaration::describe_to( fmt::Writer& w ) const
|
|
{
|
|
w << "module-function-declaration(" << module_name << "::" << name << ")";
|
|
}
|
|
|
|
} // namespace Pol::Bscript::Compiler
|