Class: LocalScope
compiler.LocalScope
A scope that is bound to a CompoundStatement and not the global namespace.
Since
0.8.0
Hierarchy
-
↳
LocalScope
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• new LocalScope(ctx
)
Parameters
Name | Type |
---|---|
ctx |
ScopeNode <LocalScope > |
Overrides
Defined in
kipper/core/src/compiler/analysis/symbol-table/local-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
ctx
• ctx: ScopeNode
<LocalScope
>
Defined in
kipper/core/src/compiler/analysis/symbol-table/local-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
parent
• get
parent(): LocalScope
| GlobalScope
The parent scope of this local scope. This will be either a LocalScope or a GlobalScope (unique to the KipperProgramContext class).
Since
0.10.0
Returns
Overrides
Scope.parent
Defined in
kipper/core/src/compiler/analysis/symbol-table/local-scope.ts:27
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/local-scope.ts:31
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/local-scope.ts:37
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/local-scope.ts:48
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/local-scope.ts:52