Interface: ScopeNode<T>
compiler.ScopeNode
Scope-node interface, which represents an ParserASTNode that supports being used as the parent of a Scope (for example, this is used for compound statements and functions).
This means that the node will have the field innerScope set to the scope that is created for it.
Since
0.10.0
Type parameters
Name | Type |
---|---|
T |
extends Scope |
Hierarchy
ParserASTNode
<SemanticData
,TypeData
>↳
ScopeNode
Implemented by
ClassConstructorDeclaration
ClassDeclaration
ClassMethodDeclaration
CompoundStatement
ForLoopIterationStatement
FunctionDeclaration
LambdaPrimaryExpression
RootASTNode
Table of contents
Properties
Accessors
Methods
Properties
_antlrRuleCtx
• Protected
Readonly
_antlrRuleCtx: KipperParserRuleContext
Inherited from
Defined in
kipper/core/src/compiler/ast/ast-node.ts:45
_children
• Protected
Readonly
_children: ParserASTNode
<any
, any
>[]
Inherited from
Defined in
kipper/core/src/compiler/ast/ast-node.ts:46
_parent
• Protected
Readonly
_parent: undefined
| ParserASTNode
<any
, any
>
Inherited from
Defined in
kipper/core/src/compiler/ast/ast-node.ts:47
_semanticData
• Protected
_semanticData: undefined
| SemanticData
Inherited from
Defined in
kipper/core/src/compiler/ast/ast-node.ts:56
_typeSemantics
• Protected
_typeSemantics: undefined
| TypeData
Inherited from
Defined in
kipper/core/src/compiler/ast/ast-node.ts:75
innerScope
• innerScope: T
The inner scope that is created for this node.
All declaration children of this ScopeNode will be added to this scope.
Since
0.10.0
Defined in
kipper/core/src/compiler/ast/scope-node.ts:24
Accessors
antlrRuleCtx
• get
antlrRuleCtx(): KipperParserRuleContext
The antlr rule context containing the antlr4 metadata for this AST node.
Since
0.8.0
Returns
Inherited from
ParserASTNode.antlrRuleCtx
Defined in
kipper/core/src/compiler/ast/ast-node.ts:114
children
• get
children(): ParserASTNode
<any
, any
>[]
The children of this AST node.
Since
0.8.0
Returns
ParserASTNode
<any
, any
>[]
Inherited from
ParserASTNode.children
Defined in
kipper/core/src/compiler/ast/ast-node.ts:141
kind
• Abstract
get
kind(): number
Returns the kind of this AST node. This represents the specific type of the antlrRuleCtx that this AST node wraps.
This may be compared using the KipperParser rule fields, for example RULE_expression.
Since
0.10.0
Returns
number
Inherited from
ParserASTNode.kind
Defined in
kipper/core/src/compiler/ast/ast-node.ts:101
parent
• get
parent(): undefined
| ParserASTNode
<any
, any
>
Returns the parent that has this node as a child. If parent is undefined, then this item is a root node.
Since
0.8.0
Returns
undefined
| ParserASTNode
<any
, any
>
Inherited from
ParserASTNode.parent
Defined in
kipper/core/src/compiler/ast/ast-node.ts:123
ruleName
• Abstract
get
ruleName(): string
Returns the identifier of this AST node. This is a unique identifier that can be used to differentiate this AST node from other AST nodes.
Since
0.11.0
Returns
string
Inherited from
ParserASTNode.ruleName
Defined in
kipper/core/src/compiler/ast/ast-node.ts:108
semanticData
• get
semanticData(): undefined
| Semantics
Returns the semantic data of this AST node.
Since
0.8.0
Returns
undefined
| Semantics
Inherited from
ParserASTNode.semanticData
Defined in
kipper/core/src/compiler/ast/ast-node.ts:62
• set
semanticData(value
): void
Sets the semantic data of this AST node.
Since
0.8.0
Parameters
Name | Type | Description |
---|---|---|
value |
undefined | Semantics |
The semantic data that should be written onto this AST node. |
Returns
void
Inherited from
ParserASTNode.semanticData
Defined in
kipper/core/src/compiler/ast/ast-node.ts:71
sourceCode
• get
sourceCode(): string
The Kipper source code that was used to generate this CompilableASTNode.
Any left-over whitespaces will be removed using trim().
Since
0.8.0
Returns
string
Inherited from
ParserASTNode.sourceCode
Defined in
kipper/core/src/compiler/ast/ast-node.ts:133
typeSemantics
• get
typeSemantics(): undefined
| TypeSemantics
Returns the type data of this AST node.
Since
0.10.0
Returns
undefined
| TypeSemantics
Inherited from
ParserASTNode.typeSemantics
Defined in
kipper/core/src/compiler/ast/ast-node.ts:81
• set
typeSemantics(value
): void
Sets the type data of this AST node.
Since
0.10.0
Parameters
Name | Type | Description |
---|---|---|
value |
undefined | TypeSemantics |
The semantic data that should be written onto this AST node. |
Returns
void
Inherited from
ParserASTNode.typeSemantics
Defined in
kipper/core/src/compiler/ast/ast-node.ts:90
Methods
addNewChild
▸ addNewChild(newChild
): void
Adds new child ctx item to this AST node. The child item should be in the order that they appeared in the this.antlrCtx parse tree.
This will also automatically set the parent of newChild to this instance.
Since
0.8.0
Parameters
Name | Type |
---|---|
newChild |
ParserASTNode <any , any > |
Returns
void
Inherited from
Defined in
kipper/core/src/compiler/ast/ast-node.ts:152
getAntlrRuleChildren
▸ getAntlrRuleChildren(): ParseTree
[]
Returns the children of the antlrRuleCtx and throws an error in case they are undefined.
Throws
If antlrRuleCtx.children is undefined.
Since
0.8.0
Returns
ParseTree
[]
Inherited from
ParserASTNode.getAntlrRuleChildren
Defined in
kipper/core/src/compiler/ast/ast-node.ts:161
getSemanticData
▸ getSemanticData(): SemanticData
Returns the semantic data of this AST node and throws an error in case it is undefined.
Throws
If semanticData is undefined.
Since
0.8.0
Returns
Inherited from
Defined in
kipper/core/src/compiler/ast/ast-node.ts:174
getTypeSemanticData
▸ getTypeSemanticData(): TypeData
Returns the type semantic data of this AST node and throws an error in case it is undefined.
Throws
UndefinedSemanticsError If semanticData is undefined.
Since
0.10.0
Returns
Inherited from
ParserASTNode.getTypeSemanticData
Defined in
kipper/core/src/compiler/ast/ast-node.ts:187