mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* Remove DefaultConstructorFunction * Modify class parameters; update semantic analysis - Use ClassDeclarationParameter for class decls vs Identifiers - Update ScopableName to have equality for constructors and unscoped function calls - Update SemanticAnalyzer (self referencing base class, no ctor) - Update, add tests * Semantic updates; debug messaging updates - Ensure base class is constructable - Various fmt implementations for debugging * Address self-review comments
47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
#ifndef POLSERVER_FUNCTIONLINK_H
|
|
#define POLSERVER_FUNCTIONLINK_H
|
|
|
|
#include "bscript/compiler/file/SourceLocation.h"
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
{
|
|
class Function;
|
|
class ModuleFunctionDeclaration;
|
|
class ScopeName;
|
|
class UserFunction;
|
|
|
|
class FunctionLink
|
|
{
|
|
public:
|
|
explicit FunctionLink( const SourceLocation&, std::string calling_scope,
|
|
bool require_ctor = false );
|
|
FunctionLink( const FunctionLink& ) = delete;
|
|
FunctionLink& operator=( const FunctionLink& ) = delete;
|
|
|
|
[[nodiscard]] Function* function() const;
|
|
[[nodiscard]] ModuleFunctionDeclaration* module_function_declaration() const;
|
|
[[nodiscard]] UserFunction* user_function() const;
|
|
|
|
void link_to( Function* );
|
|
|
|
const SourceLocation source_location;
|
|
|
|
// eg. `Animal` when calling any function inside the `Animal` class
|
|
const std::string calling_scope;
|
|
|
|
// If a FunctionLink can only be linked to a constructor (ie. the function's
|
|
// `type` is `UserFunctionType::Constructor`). Used inside:
|
|
//
|
|
// - `UserFunctionBuilder::class_declaration` to link a function to its own
|
|
// constructor,
|
|
// - `ClassParameterDeclaration` to link a class parameter (that is, a
|
|
// base-class) to its a constructor constructor
|
|
const bool require_ctor;
|
|
|
|
private:
|
|
Function* linked_function;
|
|
};
|
|
|
|
} // namespace Pol::Bscript::Compiler
|
|
|
|
#endif // POLSERVER_FUNCTIONLINK_H
|