mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* Add Report.debug * Implement function call scoping * Implement variable scoping - Rename `Identifier::scope` to `calling_scope`, and concatenate the identifier scope into `name` if necessary. - Track current scope in SemanticAnalyzer, similar to UserFunctionVisitor. - Use current scope in SemanticAnalyzer when visiting identifiers. * Update grammar for `::identifier` global scoping * Introduce ScopableName for function resolution * Address review comments - Check for display_debugs missing * Add ScopableName for identifier resolution * Some cleanup - Remove `Identifier::calling_scope`, as it is tracked in the semantic analyzer - Refactor `ScopeName::exists` to `global` for better clarification of its use - Removed `X::maybe_scoped_string/name` * Address self-review comments * Rename `Function::module_name` to `scope`
30 lines
922 B
C++
30 lines
922 B
C++
#include "ModuleFunctionDeclaration.h"
|
|
|
|
|
|
#include <utility>
|
|
|
|
#include "bscript/compiler/ast/FunctionParameterDeclaration.h"
|
|
#include "bscript/compiler/ast/FunctionParameterList.h"
|
|
#include "bscript/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( module_name ), std::move( name ),
|
|
std::move( parameter_list ) )
|
|
{
|
|
}
|
|
|
|
void ModuleFunctionDeclaration::accept( NodeVisitor& visitor )
|
|
{
|
|
visitor.visit_module_function_declaration( *this );
|
|
}
|
|
|
|
void ModuleFunctionDeclaration::describe_to( std::string& w ) const
|
|
{
|
|
fmt::format_to( std::back_inserter( w ), "module-function-declaration({}::{})", scope, name );
|
|
}
|
|
|
|
} // namespace Pol::Bscript::Compiler
|