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
40 lines
1 KiB
C++
40 lines
1 KiB
C++
#include "FunctionLink.h"
|
|
|
|
#include "bscript/compiler/ast/ModuleFunctionDeclaration.h"
|
|
#include "bscript/compiler/ast/UserFunction.h"
|
|
#include "bscript/compiler/file/SourceLocation.h"
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
{
|
|
FunctionLink::FunctionLink( const SourceLocation& source_location, std::string calling_scope,
|
|
bool require_ctor )
|
|
: source_location( source_location ),
|
|
calling_scope( std::move( calling_scope ) ),
|
|
require_ctor( require_ctor ),
|
|
linked_function( nullptr )
|
|
{
|
|
}
|
|
|
|
Function* FunctionLink::function() const
|
|
{
|
|
return linked_function;
|
|
}
|
|
|
|
ModuleFunctionDeclaration* FunctionLink::module_function_declaration() const
|
|
{
|
|
return dynamic_cast<ModuleFunctionDeclaration*>( linked_function );
|
|
}
|
|
|
|
UserFunction* FunctionLink::user_function() const
|
|
{
|
|
return dynamic_cast<UserFunction*>( linked_function );
|
|
}
|
|
|
|
void FunctionLink::link_to( Function* f )
|
|
{
|
|
if ( linked_function )
|
|
source_location.internal_error( "function already linked" );
|
|
linked_function = f;
|
|
}
|
|
|
|
} // namespace Pol::Bscript::Compiler
|