Class: Scope
compiler.Scope
A scope in a Kipper program, which can contain variables, functions and function arguments.
A scope can be a child of another scope or the global scope of a program.
Since
0.8.0
Hierarchy
Scope
Implements
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• Protected new Scope()
Defined in
kipper/core/src/compiler/analysis/symbol-table/scope.ts:19
Properties
_entries
• Protected Readonly _entries: Map<string, ScopeDeclaration>
Defined in
kipper/core/src/compiler/analysis/symbol-table/scope.ts:17
parent
• Optional Abstract parent: SymbolTable
The parent scope of this scope.
Since
0.10.0
Implementation of
Defined in
kipper/core/src/compiler/analysis/symbol-table/scope.ts:27
Accessors
entries
• get entries(): Map<string, ScopeDeclaration>
Returns the entries in this scope (symbol table entries).
Since
0.10.0
Returns
Map<string, ScopeDeclaration>
Implementation of
Defined in
kipper/core/src/compiler/analysis/symbol-table/scope.ts:33
Methods
addFunction
▸ Abstract 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.
Defined in
kipper/core/src/compiler/analysis/symbol-table/scope.ts:51
addVariable
▸ Abstract 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.
Defined in
kipper/core/src/compiler/analysis/symbol-table/scope.ts:43
getEntry
▸ Abstract 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.
Defined in
kipper/core/src/compiler/analysis/symbol-table/scope.ts:61
getEntryRecursively
▸ Abstract 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.
Defined in
kipper/core/src/compiler/analysis/symbol-table/scope.ts:72