blockly > ASTNode > getSourceBlock
ASTNode.getSourceBlock() method
Finds the source block of the location of this node.
Signature:
getSourceBlock(): Block | null;
Returns:
Block | null
The source block of the location, or null if the node is of type workspace or button.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[null,null,["Last updated 2024-09-18 UTC."],[[["The `ASTNode.getSourceBlock()` method helps locate the original block associated with a given AST node."],["This method returns the source block itself, or null if the node corresponds to the workspace or a button."],["Primarily used for tracing back from an abstract syntax tree node to its visual representation in Blockly."]]],[]]