mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* Grammar updates - Make class parameters required * Add ClassLink; wip with `super()` calls in ctors * More AST nodes as ScopableNames - (function call) Argument - FunctionParameterDeclaration * Add support for ambiguity handling * Add few more tests * Handle returns in constructors - Semantic analysis to error on returning a value - Introduce specific emitter method for returning from constructor - Various tests * Refactor super building to pre-semantic analysis * Adding several tests, some are TODO - found an issue with function resolver and funcrefs, fix later * Address self-review comments * Fix funcref global func references, tests
33 lines
760 B
C++
33 lines
760 B
C++
#pragma once
|
|
|
|
#include "bscript/compiler/file/SourceLocation.h"
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
{
|
|
class ClassDeclaration;
|
|
class ModuleFunctionDeclaration;
|
|
class ScopeName;
|
|
class UserFunction;
|
|
|
|
// An analogous class to FunctionLink, but for classes. Allows a UserFunction to
|
|
// link to a ClassDeclaration.
|
|
class ClassLink
|
|
{
|
|
public:
|
|
explicit ClassLink( const SourceLocation&, std::string name );
|
|
ClassLink( const ClassLink& ) = delete;
|
|
ClassLink& operator=( const ClassLink& ) = delete;
|
|
|
|
[[nodiscard]] ClassDeclaration* class_declaration() const;
|
|
|
|
void link_to( ClassDeclaration* );
|
|
|
|
const SourceLocation source_location;
|
|
|
|
const std::string name;
|
|
|
|
private:
|
|
ClassDeclaration* linked_class_declaration;
|
|
};
|
|
|
|
} // namespace Pol::Bscript::Compiler
|