Class: ScopeFunctionDeclaration
compiler.ScopeFunctionDeclaration
Represents the definition of a function inside a Scope.
Since
0.1.2
Hierarchy
-
↳
ScopeFunctionDeclaration
Table of contents
Constructors
Properties
Accessors
- builtInStructure
- hasValue
- identifier
- isBuiltIn
- isCallable
- isDefined
- node
- params
- programCtx
- returnType
- scope
- semanticData
- type
- typeData
Methods
- fromBuiltInFunction
- fromClassConstructorDeclaration
- fromClassMethodDeclaration
- fromFunctionDeclaration
Constructors
constructor
• Private
new ScopeFunctionDeclaration(_declaration?
, _builtInFunction?
, _universeScope?
)
Parameters
Name | Type |
---|---|
_declaration? |
FunctionDeclaration | ClassMethodDeclaration | ClassConstructorDeclaration |
_builtInFunction? |
BuiltInFunction |
_universeScope? |
UniverseScope |
Overrides
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:27
Properties
_builtInFunction
• Private
Optional
Readonly
_builtInFunction: BuiltInFunction
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:29
_declaration
• Private
Optional
Readonly
_declaration: FunctionDeclaration
| ClassMethodDeclaration
| ClassConstructorDeclaration
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:28
_universeScope
• Private
Optional
Readonly
_universeScope: UniverseScope
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:30
Accessors
builtInStructure
• get
builtInStructure(): undefined
| BuiltInFunction
Returns the built-in structure of this declaration, if this declaration is based on one.
Since
0.11.0
Returns
undefined
| BuiltInFunction
Overrides
ScopeDeclaration.builtInStructure
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:80
hasValue
• get
hasValue(): boolean
Returns whether the function declaration has a value.
Since
0.10.0
Returns
boolean
Overrides
ScopeDeclaration.hasValue
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:169
identifier
• get
identifier(): string
The identifier of this function.
Returns
string
Overrides
ScopeDeclaration.identifier
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:120
isBuiltIn
• get
isBuiltIn(): boolean
Returns whether this function declaration is a built-in function.
Since
0.11.0
Returns
boolean
Overrides
ScopeDeclaration.isBuiltIn
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:72
isCallable
• get
isCallable(): boolean
Returns whether the declaration has a callable value (function).
Since
0.10.0
Returns
boolean
Overrides
ScopeDeclaration.isCallable
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:177
isDefined
• get
isDefined(): boolean
Returns whether the function declaration is defined and has a function body set during declaration.
Since
0.3.0
Returns
boolean
Overrides
ScopeDeclaration.isDefined
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:161
node
• get
node(): undefined
| FunctionDeclaration
| ClassMethodDeclaration
| ClassConstructorDeclaration
Returns the AST node this scope function declaration bases on.
Returns
undefined
| FunctionDeclaration
| ClassMethodDeclaration
| ClassConstructorDeclaration
Overrides
ScopeDeclaration.node
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:113
params
• get
params(): ParameterDeclaration
[] | BuiltInFunctionArgument
[]
The parameters that are accepted inside this function. These are represented using the ParameterDeclaration class.
The index in the array represents the position inside the function. Meaning the first item in the array maps to the first parameter inside the function.
Returns
ParameterDeclaration
[] | BuiltInFunctionArgument
[]
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:153
programCtx
• get
programCtx(): undefined
| KipperProgramContext
Fetches the program context instance for this token.
Returns
undefined
| KipperProgramContext
Inherited from
ScopeDeclaration.programCtx
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-declaration.ts:25
returnType
• get
returnType(): ProcessedType
The return type of this function. This can be every KipperType except KipperFuncType.
Returns
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:135
scope
• get
scope(): ClassScope
| GlobalScope
| UniverseScope
Returns the scope associated with this ScopeDeclaration.
Returns
ClassScope
| GlobalScope
| UniverseScope
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:142
semanticData
• Private
get
semanticData(): undefined
| FunctionDeclarationSemantics
| ClassMethodDeclarationSemantics
| ClassConstructorDeclarationSemantics
The semantic data of this declaration.
Throws
UndefinedSemanticsError If this is accessed, before semantic analysis was performed.
Returns
undefined
| FunctionDeclarationSemantics
| ClassMethodDeclarationSemantics
| ClassConstructorDeclarationSemantics
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:89
type
• get
type(): BuiltInTypeFunc
The type of this function. This is always "func".
Since
0.10.0
Returns
Overrides
ScopeDeclaration.type
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:128
typeData
• Private
get
typeData(): undefined
| FunctionDeclarationTypeSemantics
| ClassMethodDeclarationTypeSemantics
| ClassConstructorDeclarationTypeSemantics
The type data of this declaration.
Throws
UndefinedSemanticsError If this is accessed, before type checking was performed.
Returns
undefined
| FunctionDeclarationTypeSemantics
| ClassMethodDeclarationTypeSemantics
| ClassConstructorDeclarationTypeSemantics
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:102
Methods
fromBuiltInFunction
▸ Static
fromBuiltInFunction(declaration
, universeScope
): ScopeFunctionDeclaration
Creates a new scope function declaration from a function declaration.
Parameters
Name | Type | Description |
---|---|---|
declaration |
BuiltInFunction |
The function declaration node. |
universeScope |
UniverseScope |
The universe scope i.e. the scope for all the built-ins. |
Returns
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:64
fromClassConstructorDeclaration
▸ Static
fromClassConstructorDeclaration(declaration
): ScopeFunctionDeclaration
Creates a new scope function declaration from a given class constructor declaration.
Parameters
Name | Type | Description |
---|---|---|
declaration |
ClassConstructorDeclaration |
The constructor declaration node. |
Returns
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:55
fromClassMethodDeclaration
▸ Static
fromClassMethodDeclaration(declaration
): ScopeFunctionDeclaration
Creates a new scope function declaration from a given class method declaration.
Parameters
Name | Type | Description |
---|---|---|
declaration |
ClassMethodDeclaration |
The method declaration node. |
Returns
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:47
fromFunctionDeclaration
▸ Static
fromFunctionDeclaration(declaration
): ScopeFunctionDeclaration
Creates a new scope function declaration from a function declaration.
Parameters
Name | Type | Description |
---|---|---|
declaration |
FunctionDeclaration |
The function declaration node. |
Returns
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-function-declaration.ts:39