Class: FunctionScope
compiler.FunctionScope
A function-specific scope that is bound to a FunctionDeclaration and not the global namespace.
Since
0.10.0
Hierarchy
-
↳
FunctionScope
↳↳
LambdaScope
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• new FunctionScope(ctx
)
Parameters
Name | Type |
---|---|
ctx |
FunctionDeclaration | LambdaPrimaryExpression | ClassMethodDeclaration | ClassConstructorDeclaration |
Overrides
Defined in
kipper/core/src/compiler/semantics/symbol-table/function-scope.ts:24
Properties
_arguments
• Protected
Readonly
_arguments: Map
<string
, ScopeParameterDeclaration
>
Defined in
kipper/core/src/compiler/semantics/symbol-table/function-scope.ts:22
_entries
• Protected
Readonly
_entries: Map
<string
, ScopeDeclaration
>
Inherited from
Defined in
kipper/core/src/compiler/semantics/symbol-table/base/scope.ts:21
ctx
• ctx: FunctionDeclaration
| LambdaPrimaryExpression
| ClassMethodDeclaration
| ClassConstructorDeclaration
Inherited from
Defined in
kipper/core/src/compiler/semantics/symbol-table/function-scope.ts:25
Accessors
arguments
• get
arguments(): Map
<string
, ScopeParameterDeclaration
>
All local arguments in this scope, which were defined by the parent function.
These are available as usual to all children scopes.
Since
0.10.0
Returns
Map
<string
, ScopeParameterDeclaration
>
Defined in
kipper/core/src/compiler/semantics/symbol-table/function-scope.ts:37
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
LocalScope.entries
Defined in
kipper/core/src/compiler/semantics/symbol-table/base/scope.ts:37
parent
• get
parent(): LocalScope
| ClassScope
| 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
LocalScope
| ClassScope
| GlobalScope
Inherited from
LocalScope.parent
Defined in
kipper/core/src/compiler/semantics/symbol-table/local-scope.ts:34
Methods
addArgument
▸ addArgument(declaration
): ScopeParameterDeclaration
Adds a new argument declaration to the list of arguments.
Since
0.10.0
Parameters
Name | Type | Description |
---|---|---|
declaration |
ParameterDeclaration |
The argument declaration to add. |
Returns
The generated scope declaration.
Defined in
kipper/core/src/compiler/semantics/symbol-table/function-scope.ts:47
addFunction
▸ addFunction(declaration
): ScopeFunctionDeclaration
Parameters
Name | Type |
---|---|
declaration |
FunctionDeclaration |
Returns
Inherited from
Defined in
kipper/core/src/compiler/semantics/symbol-table/local-scope.ts:38
addType
▸ addType(declaration
): ScopeTypeDeclaration
Parameters
Name | Type |
---|---|
declaration |
TypeDeclaration <TypeDeclarationSemantics , TypeDeclarationTypeSemantics > |
Returns
Inherited from
Defined in
kipper/core/src/compiler/semantics/symbol-table/local-scope.ts:53
addVariable
▸ addVariable(declaration
): ScopeVariableDeclaration
Parameters
Name | Type |
---|---|
declaration |
VariableDeclaration |
Returns
Inherited from
Defined in
kipper/core/src/compiler/semantics/symbol-table/local-scope.ts:44
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
Defined in
kipper/core/src/compiler/semantics/symbol-table/base/user-scope.ts:22
getArgument
▸ getArgument(identifier
): undefined
| ScopeParameterDeclaration
Searches for an argument with the passed identifier in the current scope.
Since
0.10.0
Parameters
Name | Type | Description |
---|---|---|
identifier |
string |
The identifier of the argument. |
Returns
undefined
| ScopeParameterDeclaration
Defined in
kipper/core/src/compiler/semantics/symbol-table/function-scope.ts:61
getEntry
▸ getEntry(identifier
): undefined
| ScopeDeclaration
Parameters
Name | Type |
---|---|
identifier |
string |
Returns
undefined
| ScopeDeclaration
Overrides
Defined in
kipper/core/src/compiler/semantics/symbol-table/function-scope.ts:65
getEntryRecursively
▸ getEntryRecursively(identifier
): undefined
| ScopeDeclaration
Parameters
Name | Type |
---|---|
identifier |
string |
Returns
undefined
| ScopeDeclaration
Inherited from
LocalScope.getEntryRecursively
Defined in
kipper/core/src/compiler/semantics/symbol-table/local-scope.ts:63