RuntimeScope
Represents a scope in the execution stack of a Loreline script. Every time we enter a new block node, we enter a new scope identified with a unique integer value. When exiting that scope, the related temporary states associated with it are destroyed.
Instance Members
id: IntThe scope id, a unique integer value in the stack.
beat: NBeatDeclThe parent beat where this scope is located. Can be either a top level beat or a nested beat.
node: AstNodeThe node where this scope is attached.
The nested beat declarations, if any, found in this scope.
state: RuntimeStateThe temporary state associated with this scope, if any.
head: AstNodeIf applicable, the node this scope's "reading head" is at. This is used to track the current execution position within the scope.
insertion: RuntimeInsertionIf this scope was created from an insertion, this is the insertion runtime data.
captured: Array<RuntimeScope>If this scope runs a beat invoked through a beat reference, this is the scope chain captured when the reference was created (closure). Name resolution inside this scope walks this chain instead of the scopes below it in the stack, then jumps to top-level.
Finds a nested beat declaration with the given name in this scope, if any.
| Name | Type | Description |
|---|---|---|
name |
String | The name of the beat to find |
| Returns | Description |
|---|---|
| Null<NBeatDecl> | The beat declaration if found, null otherwise |
new(?id: Null<Int>, beat: NBeatDecl, node: AstNode, ?beats: Null<Array<NBeatDecl>>, ?state: Null<RuntimeState>, ?head: Null<AstNode>, ?insertion: Null<RuntimeInsertion>, ?captured: Null<Array<RuntimeScope>>): Void| Name | Type | Default | Description |
|---|---|---|---|
id |
Null<Int> | (optional) | * The scope id, a unique integer value in the stack. |
beat |
NBeatDecl | * The parent beat where this scope is located. Can be either a top level beat or a nested beat. | |
node |
AstNode | * The node where this scope is attached. | |
beats |
Null<Array<NBeatDecl>> | (optional) | * The nested beat declarations, if any, found in this scope. |
state |
Null<RuntimeState> | (optional) | * The temporary state associated with this scope, if any. |
head |
Null<AstNode> | (optional) | * If applicable, the node this scope's "reading head" is at. This is used to track the current execution position within the scope. |
insertion |
Null<RuntimeInsertion> | (optional) | * If this scope was created from an insertion, this is the insertion runtime data. |
captured |
Null<Array<RuntimeScope>> | (optional) | * If this scope runs a beat invoked through a beat reference, this is the scope chain captured when the reference was created (closure). Name resolution inside this scope walks this chain instead of the scopes below it in the stack, then jumps to top-level. |
Metadata
| Name | Parameters |
|---|---|
:structInit |
- |