blockly > ASTNode
ASTNode class
Class for an AST node. It is recommended that you use one of the createNode methods instead of creating a node directly.
Signature:
export declare class ASTNode
Constructors
Properties
Property |
Modifiers |
Type |
Description |
NAVIGATE_ALL_FIELDS |
static |
boolean |
True to navigate to all fields. False to only navigate to clickable fields. |
Methods
Method |
Modifiers |
Description |
createBlockNode(block) |
static |
Creates an AST node pointing to a block. |
createConnectionNode(connection) |
static |
Creates an AST node pointing to a connection. If the connection has a parent input then create an AST node of type input that will hold the connection. |
createFieldNode(field) |
static |
Create an AST node pointing to a field. |
createInputNode(input) |
static |
Creates an AST node pointing to an input. Stores the input connection as the location. |
createStackNode(topBlock) |
static |
Create an AST node of type stack. A stack, represented by its top block, is the set of all blocks connected to a top block, including the top block. |
createTopNode(block) |
static |
Creates an AST node for the top position on a block. This is either an output connection, previous connection, or block. |
createWorkspaceNode(workspace, wsCoordinate) |
static |
Creates an AST node pointing to a workspace. |
getLocation() |
|
Gets the value pointed to by this node. It is the callers responsibility to check the node type to figure out what type of object they get back from this. |
getSourceBlock() |
|
Finds the source block of the location of this node. |
getType() |
|
The type of the current location. One of ASTNode.types |
getWsCoordinate() |
|
The coordinate on the workspace. |
in() |
|
Find the element one level below and all the way to the left of the current location. |
next() |
|
Find the element to the right of the current element in the AST. |
out() |
|
Find the next element that is one position above and all the way to the left of the current location. |
prev() |
|
Find the element to the left of the current element in the AST. |