Package org.codehaus.groovy.ast.stmt
Class EmptyStatement
java.lang.Object
org.codehaus.groovy.ast.ASTNode
org.codehaus.groovy.ast.stmt.Statement
org.codehaus.groovy.ast.stmt.EmptyStatement
- All Implemented Interfaces:
NodeMetaDataHandler
Represents an empty statement that performs no operation.
An empty statement is a valid statement that can appear wherever a statement is expected
but has no executable code. Empty statements are often used as default cases or as placeholders
in control flow structures.
An immutable singleton INSTANCE is provided for use when source position or
other occurrence-specific metadata is not needed. Using the singleton reduces memory overhead.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EmptyStatementImmutable singleton that is recommended for use when source range or any other occurrence-specific metadata is not needed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisEmpty()Returns true if this statement is empty or produces no side effects.voidvisit(GroovyCodeVisitor visitor) Accepts a code visitor for AST traversal and transformation.Methods inherited from class org.codehaus.groovy.ast.stmt.Statement
addStatementAnnotation, addStatementLabel, copyStatementLabels, getStatementAnnotations, getStatementLabel, getStatementLabels, setStatementLabelMethods inherited from class org.codehaus.groovy.ast.ASTNode
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler
copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, newMetaDataMap, putNodeMetaData, removeNodeMetaData, setNodeMetaData
-
Field Details
-
INSTANCE
Immutable singleton that is recommended for use when source range or any other occurrence-specific metadata is not needed. Using this singleton conserves memory by avoiding unnecessary object allocations.- See Also:
-
-
Constructor Details
-
Method Details
-
isEmpty
public boolean isEmpty()Description copied from class:StatementReturns true if this statement is empty or produces no side effects. Typically onlyEmptyStatementreturns true. -
visit
Description copied from class:ASTNodeAccepts a code visitor for AST traversal and transformation. Subclasses must implement this method to support visitor pattern-based processing. The visitor pattern enables decoupling of AST structure from processing logic.- Overrides:
visitin classASTNode- Parameters:
visitor- theGroovyCodeVisitorto process this node
-