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
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
#ifndef POLSERVER_USERFUNCTION_H
|
|
#define POLSERVER_USERFUNCTION_H
|
|
|
|
#include "bscript/compiler/ast/Function.h"
|
|
#include "bscript/compiler/model/LocalVariableScopeInfo.h"
|
|
#include "bscript/compiler/model/UserFunctionType.h"
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
{
|
|
class ClassLink;
|
|
class FunctionParameterList;
|
|
class FunctionBody;
|
|
class Variable;
|
|
|
|
class UserFunction : public Function
|
|
{
|
|
public:
|
|
UserFunction( const SourceLocation&, bool exported, bool expression, UserFunctionType type,
|
|
std::string scope, std::string name, std::unique_ptr<FunctionParameterList>,
|
|
std::unique_ptr<FunctionBody>, const SourceLocation& endfunction_location,
|
|
std::shared_ptr<ClassLink> );
|
|
|
|
void accept( NodeVisitor& ) override;
|
|
void describe_to( std::string& ) const override;
|
|
|
|
const bool exported;
|
|
const bool expression;
|
|
const UserFunctionType type;
|
|
const SourceLocation endfunction_location;
|
|
std::shared_ptr<ClassLink> class_link;
|
|
|
|
LocalVariableScopeInfo local_variable_scope_info;
|
|
LocalVariableScopeInfo capture_variable_scope_info;
|
|
|
|
unsigned capture_count() const;
|
|
|
|
FunctionBody& body();
|
|
};
|
|
|
|
} // namespace Pol::Bscript::Compiler
|
|
|
|
#endif // POLSERVER_USERFUNCTION_H
|