Class: GlobalScope
compiler.GlobalScope
The global scope of a KipperProgramContext, which contains the global variables and functions of a Kipper program.
Since
0.8.0
Hierarchy
-
↳
GlobalScope
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• new GlobalScope(programCtx
)
Parameters
Name | Type |
---|---|
programCtx |
KipperProgramContext |
Overrides
Defined in
kipper/core/src/compiler/analysis/symbol-table/global-scope.ts:18
Properties
_entries
• Protected
Readonly
_entries: Map
<string
, ScopeDeclaration
>
Inherited from
Defined in
kipper/core/src/compiler/analysis/symbol-table/scope.ts:17
parent
• parent: undefined
= undefined
The parent scope of this global scope. This is always undefined
.
Since
0.10.0
Overrides
Defined in
kipper/core/src/compiler/analysis/symbol-table/global-scope.ts:26
programCtx
• programCtx: KipperProgramContext
Defined in
kipper/core/src/compiler/analysis/symbol-table/global-scope.ts:18
Accessors
entries
• get
entries(): Map
<string
, ScopeDeclaration
>
Returns the entries in this scope (symbol table entries).
Since
0.10.0
Returns
Map
<string
, ScopeDeclaration
>
Inherited from
Scope.entries
Defined in
kipper/core/src/compiler/analysis/symbol-table/scope.ts:33
Methods
addFunction
▸ addFunction(declaration
): ScopeFunctionDeclaration
Adds a new function declaration to the symbol table entries.
Since
0.8.0
Parameters
Name | Type | Description |
---|---|---|
declaration |
FunctionDeclaration |
The declaration to add. |
Returns
The generated scope declaration.
Overrides
Defined in
kipper/core/src/compiler/analysis/symbol-table/global-scope.ts:28
addVariable
▸ addVariable(declaration
): ScopeVariableDeclaration
Adds a new variable declaration to the symbol table entries.
Since
0.8.0
Parameters
Name | Type | Description |
---|---|---|
declaration |
VariableDeclaration |
The declaration to add. |
Returns
The generated scope declaration.
Overrides
Defined in
kipper/core/src/compiler/analysis/symbol-table/global-scope.ts:39
getEntry
▸ getEntry(identifier
): undefined
| ScopeDeclaration
Searches for a reference/entry with the specific identifier in the local hash table entries (local scope).
If no reference is found, undefined will be returned.
Since
0.8.0
Parameters
Name | Type | Description |
---|---|---|
identifier |
string |
The identifier to search for. |
Returns
undefined
| ScopeDeclaration
The found reference or undefined.
Overrides
Defined in
kipper/core/src/compiler/analysis/symbol-table/global-scope.ts:50
getEntryRecursively
▸ getEntryRecursively(identifier
): undefined
| ScopeDeclaration
Searches for a reference/entry with the specific identifier in the local hash table entries (local scope) and all parent scopes.
If no reference is found, undefined will be returned.
Since
0.10.0
Parameters
Name | Type | Description |
---|---|---|
identifier |
string |
The identifier to search for. |
Returns
undefined
| ScopeDeclaration
The found reference or undefined.
Overrides
Defined in
kipper/core/src/compiler/analysis/symbol-table/global-scope.ts:54