polserver/pol-core/bscript/compiler/ast/ModuleFunctionDeclaration.h
Kevin Eady e3512d001b Add scope handling for functions and variables (#690)
* 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`
2024-10-10 18:06:04 +02:00

25 lines
736 B
C++

#ifndef POLSERVER_MODULEFUNCTIONDECLARATION_H
#define POLSERVER_MODULEFUNCTIONDECLARATION_H
#include "bscript/compiler/ast/Function.h"
namespace Pol::Bscript::Compiler
{
class NodeVisitor;
class FunctionParameterDeclaration;
class FunctionParameterList;
class ModuleFunctionDeclaration : public Function
{
public:
ModuleFunctionDeclaration( const SourceLocation& source_location, std::string module_name,
std::string name,
std::unique_ptr<FunctionParameterList> parameter_list );
void accept( NodeVisitor& visitor ) override;
void describe_to( std::string& ) const override;
};
} // namespace Pol::Bscript::Compiler
#endif // POLSERVER_MODULEFUNCTIONDECLARATION_H