Class: ClassScope
compiler.ClassScope
A function-specific scope that is bound to a FunctionDeclaration and not the global namespace.
Since
0.11.0
Hierarchy
UserScope↳
ClassScope
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• new ClassScope(ctx)
Parameters
| Name | Type |
|---|---|
ctx |
ClassDeclaration |
Overrides
UserScope.constructor
Defined in
kipper/core/src/compiler/semantics/symbol-table/class-scope.ts:25
Properties
_entries
• Protected Readonly _entries: Map<string, ScopeDeclaration>
Inherited from
UserScope._entries
Defined in
kipper/core/src/compiler/semantics/symbol-table/base/scope.ts:21
ctx
• Readonly ctx: ClassDeclaration
Inherited from
UserScope.ctx
Defined in
kipper/core/src/compiler/semantics/symbol-table/class-scope.ts:25
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
UserScope.entries
Defined in
kipper/core/src/compiler/semantics/symbol-table/base/scope.ts:37
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
UserScope.parent
Defined in
kipper/core/src/compiler/semantics/symbol-table/class-scope.ts:34
Methods
addConstructor
▸ addConstructor(declaration): ScopeFunctionDeclaration
Parameters
| Name | Type |
|---|---|
declaration |
ClassConstructorDeclaration |
Returns
Defined in
kipper/core/src/compiler/semantics/symbol-table/class-scope.ts:38
addFunction
▸ addFunction(declaration): ScopeFunctionDeclaration
Parameters
| Name | Type |
|---|---|
declaration |
ClassMethodDeclaration |
Returns
Overrides
UserScope.addFunction
Defined in
kipper/core/src/compiler/semantics/symbol-table/class-scope.ts:47
addType
▸ addType(declaration): ScopeTypeDeclaration
Parameters
| Name | Type |
|---|---|
declaration |
any |
Returns
Overrides
UserScope.addType
Defined in
kipper/core/src/compiler/semantics/symbol-table/class-scope.ts:65
addVariable
▸ addVariable(declaration): ScopeVariableDeclaration
Parameters
| Name | Type |
|---|---|
declaration |
ClassPropertyDeclaration |
Returns
Overrides
UserScope.addVariable
Defined in
kipper/core/src/compiler/semantics/symbol-table/class-scope.ts:56
ensureNotUsed
▸ Private ensureNotUsed(identifier, declaration): 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. |
declaration |
Declaration<DeclarationSemantics, DeclarationTypeSemantics> |
The declaration to check. |
Returns
void
Inherited from
UserScope.ensureNotUsed
Defined in
kipper/core/src/compiler/semantics/symbol-table/base/user-scope.ts:22
getEntry
▸ getEntry(identifier): undefined | ScopeDeclaration
Parameters
| Name | Type |
|---|---|
identifier |
string |
Returns
undefined | ScopeDeclaration
Overrides
UserScope.getEntry
Defined in
kipper/core/src/compiler/semantics/symbol-table/class-scope.ts:79
getEntryRecursively
▸ getEntryRecursively(identifier): undefined | ScopeDeclaration
Parameters
| Name | Type |
|---|---|
identifier |
string |
Returns
undefined | ScopeDeclaration
Overrides
UserScope.getEntryRecursively
Defined in
kipper/core/src/compiler/semantics/symbol-table/class-scope.ts:83
getThis
▸ getThis(): ClassScopeThisDeclaration
Gets the "this" keyword which is simply a reference to the class.
Since
0.12.0
Returns
ClassScopeThisDeclaration
Defined in
kipper/core/src/compiler/semantics/symbol-table/class-scope.ts:75