Class: ScopeVariableDeclaration
compiler.ScopeVariableDeclaration
Represents a variable scope entry that may be a child of the global scope or local scope.
Since
0.1.0
Hierarchy
-
↳
ScopeVariableDeclaration
Table of contents
Constructors
Properties
Accessors
- builtInStructure
- hasValue
- identifier
- isBuiltIn
- isCallable
- isDefined
- node
- programCtx
- scope
- semanticData
- storageType
- type
- typeData
- valueWasUpdated
Methods
Constructors
constructor
• Protected
new ScopeVariableDeclaration(_declaration?
, _builtInVariable?
, _universeScope?
)
Parameters
Name | Type |
---|---|
_declaration? |
VariableDeclaration | ClassPropertyDeclaration |
_builtInVariable? |
BuiltInVariable |
_universeScope? |
UniverseScope |
Overrides
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:26
Properties
_builtInVariable
• Private
Optional
Readonly
_builtInVariable: BuiltInVariable
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:28
_declaration
• Private
Optional
Readonly
_declaration: VariableDeclaration
| ClassPropertyDeclaration
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:27
_universeScope
• Private
Optional
Readonly
_universeScope: UniverseScope
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:29
_valueWasUpdated
• Private
_valueWasUpdated: boolean
= false
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:24
Accessors
builtInStructure
• get
builtInStructure(): undefined
| BuiltInVariable
Returns the built-in structure of this declaration, if this declaration is based on one.
Since
0.11.0
Returns
undefined
| BuiltInVariable
Overrides
ScopeDeclaration.builtInStructure
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:74
hasValue
• get
hasValue(): boolean
Returns whether the variable declaration has a value.
This is different from isDefined, since this also considers variable assignments after the initial declaration.
Since
0.10.0
Returns
boolean
Overrides
ScopeDeclaration.hasValue
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:163
identifier
• get
identifier(): string
The identifier of this variable.
Returns
string
Overrides
ScopeDeclaration.identifier
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:106
isBuiltIn
• get
isBuiltIn(): boolean
Returns whether this variable declaration is a built-in declaration.
Since
0.11.0
Returns
boolean
Overrides
ScopeDeclaration.isBuiltIn
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:66
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-variable-declaration.ts:171
isDefined
• get
isDefined(): boolean
Returns whether the variable declaration is defined and has a value set during declaration.
Returns
boolean
Overrides
ScopeDeclaration.isDefined
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:134
node
• get
node(): undefined
| VariableDeclaration
| ClassPropertyDeclaration
Returns the AST node this scope declaration bases on.
Returns
undefined
| VariableDeclaration
| ClassPropertyDeclaration
Overrides
ScopeDeclaration.node
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:99
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
scope
• get
scope(): LocalScope
| ClassScope
| GlobalScope
| UniverseScope
Returns the scope associated with this ScopeDeclaration.
Returns
LocalScope
| ClassScope
| GlobalScope
| UniverseScope
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:127
semanticData
• Private
get
semanticData(): undefined
| VariableDeclarationSemantics
| ClassPropertyDeclarationSemantics
The semantic data of this declaration.
Throws
UndefinedSemanticsError If this is accessed, before semantic analysis was performed.
Returns
undefined
| VariableDeclarationSemantics
| ClassPropertyDeclarationSemantics
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:83
storageType
• get
storageType(): KipperStorageType
The storage type of this variable.
Returns
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:120
type
• get
type(): ProcessedType
The value type of this variable.
Returns
Overrides
ScopeDeclaration.type
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:113
typeData
• Private
get
typeData(): undefined
| VariableDeclarationTypeSemantics
| ClassPropertyDeclarationTypeSemantics
The type data of this declaration.
Throws
UndefinedSemanticsError If this is accessed, before type checking was performed.
Returns
undefined
| VariableDeclarationTypeSemantics
| ClassPropertyDeclarationTypeSemantics
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:92
valueWasUpdated
• get
valueWasUpdated(): boolean
Returns whether the value of the variable was updated after the initial declaration.
Since
0.10.0
Returns
boolean
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:142
Methods
notifyOfUpdate
▸ notifyOfUpdate(): void
Notifies the declaration that the value was updated.
Sets the valueWasUpdated property to true.
Since
0.11.0
Returns
void
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:152
fromBuiltInVariable
▸ Static
fromBuiltInVariable(builtInVariable
, universeScope
): ScopeVariableDeclaration
Creates a new scope variable declaration from a built-in variable.
Parameters
Name | Type | Description |
---|---|---|
builtInVariable |
BuiltInVariable |
The built-in variable. |
universeScope |
UniverseScope |
The universe scope this variable is associated with. |
Returns
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:55
fromClassPropertyDeclaration
▸ Static
fromClassPropertyDeclaration(declaration
): ScopeVariableDeclaration
Creates a new scope variable declaration from a given class property declaration.
Parameters
Name | Type | Description |
---|---|---|
declaration |
ClassPropertyDeclaration |
The class property declaration. |
Returns
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:46
fromVariableDeclaration
▸ Static
fromVariableDeclaration(declaration
): ScopeVariableDeclaration
Creates a new scope variable declaration from a variable declaration.
Parameters
Name | Type | Description |
---|---|---|
declaration |
VariableDeclaration |
The variable declaration node. |
Returns
Defined in
kipper/core/src/compiler/semantics/symbol-table/entry/scope-variable-declaration.ts:38