Class: UniverseScope
compiler.UniverseScope
The universal scope which only defines built-ins and is not bound to any specific context.
Since
0.11.0
Hierarchy
Scope<never,never,BuiltInType>↳
UniverseScope
Table of contents
Constructors
Properties
Accessors
Methods
- addFunction
- addType
- addVariable
- clearUniversalFunctions
- clearUniversalVariables
- ensureNotUsed
- getEntry
- getEntryRecursively
- init
Constructors
constructor
• new UniverseScope(ctx)
Parameters
| Name | Type |
|---|---|
ctx |
KipperProgramContext |
Overrides
Defined in
kipper/core/src/compiler/semantics/symbol-table/universe-scope.ts:77
Properties
_entries
• Protected Readonly _entries: Map<string, ScopeDeclaration>
Inherited from
Defined in
kipper/core/src/compiler/semantics/symbol-table/base/scope.ts:21
ctx
• ctx: KipperProgramContext
Defined in
kipper/core/src/compiler/semantics/symbol-table/universe-scope.ts:77
parent
• Readonly parent: undefined
The parent scope of this scope.
Since
0.10.0
Overrides
Defined in
kipper/core/src/compiler/semantics/symbol-table/universe-scope.ts:75
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/semantics/symbol-table/base/scope.ts:37
Methods
addFunction
▸ addFunction(declaration): ScopeFunctionDeclaration
Adds a built-in function to the universal scope.
Since
0.11.0
Parameters
| Name | Type | Description |
|---|---|---|
declaration |
BuiltInFunction |
The built-in function to add. |
Returns
The scope declaration of the added function.
Overrides
Defined in
kipper/core/src/compiler/semantics/symbol-table/universe-scope.ts:128
addType
▸ addType(declaration): ScopeTypeDeclaration
Adds a built-in type to the universal scope.
Since
0.11.0
Parameters
| Name | Type | Description |
|---|---|---|
declaration |
BuiltInType |
The built-in type to add. |
Returns
The scope declaration of the added type.
Overrides
Defined in
kipper/core/src/compiler/semantics/symbol-table/universe-scope.ts:141
addVariable
▸ addVariable(declaration): ScopeVariableDeclaration
Adds a built-in variable to the universal scope.
Since
0.11.0
Parameters
| Name | Type | Description |
|---|---|---|
declaration |
BuiltInVariable |
The built-in variable to add. |
Returns
The scope declaration of the added variable.
Overrides
Defined in
kipper/core/src/compiler/semantics/symbol-table/universe-scope.ts:115
clearUniversalFunctions
▸ clearUniversalFunctions(): void
DANGEROUS METHOD! Clears all the universal functions and create dangling references.
Since
0.11.0
Returns
void
Defined in
kipper/core/src/compiler/semantics/symbol-table/universe-scope.ts:172
clearUniversalVariables
▸ clearUniversalVariables(): void
DANGEROUS METHOD! Clears all the universal variables and create dangling references.
Since
0.11.0
Returns
void
Defined in
kipper/core/src/compiler/semantics/symbol-table/universe-scope.ts:180
ensureNotUsed
▸ Private ensureNotUsed(identifier): void
Ensures that the given declaration is not already used in the current scope.
Since
0.12.0
Parameters
| Name | Type | Description |
|---|---|---|
identifier |
string |
The identifier to check. |
Returns
void
Defined in
kipper/core/src/compiler/semantics/symbol-table/universe-scope.ts:103
getEntry
▸ getEntry(identifier): undefined | ScopeDeclaration
Retrieves a scope declaration from the universal scope.
Since
0.11.0
Parameters
| Name | Type | Description |
|---|---|---|
identifier |
string |
The identifier of the declaration to retrieve. |
Returns
undefined | ScopeDeclaration
The scope declaration if it exists, otherwise undefined.
Overrides
Defined in
kipper/core/src/compiler/semantics/symbol-table/universe-scope.ts:154
getEntryRecursively
▸ getEntryRecursively(identifier): undefined | ScopeDeclaration
Retrieves a scope declaration from the universal scope recursively.
Since
0.11.0
Parameters
| Name | Type | Description |
|---|---|---|
identifier |
string |
The identifier of the declaration to retrieve. |
Returns
undefined | ScopeDeclaration
The scope declaration if it exists, otherwise undefined.
Overrides
Defined in
kipper/core/src/compiler/semantics/symbol-table/universe-scope.ts:164
init
▸ init(): void
Initializes the universal scope by adding all built-in types, functions and variables.
Since
0.11.0
Returns
void
Defined in
kipper/core/src/compiler/semantics/symbol-table/universe-scope.ts:85