public class ExpressionStatement
extends Statement
Represents an expression statement that executes an expression where the return value is ignored. An expression statement wraps an Expression for use as a statement in contexts where an expression must be treated as a statement (e.g., method calls, assignments, or other side-effect-producing expressions). The expression is evaluated and its result is discarded.
| Constructor and description |
|---|
ExpressionStatement(Expression expression)Constructs an expression statement with the given expression. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public Expression |
getExpression()Returns the expression executed by this statement. |
|
public String |
getText() |
|
public void |
setExpression(Expression expression)Sets the expression executed by this statement. |
|
public String |
toString() |
|
public void |
visit(GroovyCodeVisitor visitor) |
| Methods inherited from class | Name |
|---|---|
class Statement |
addStatementAnnotation, addStatementLabel, copyStatementLabels, getStatementAnnotations, getStatementLabel, getStatementLabels, isEmpty, setStatementLabel |
class ASTNode |
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit |
Constructs an expression statement with the given expression.
expression - the Expression to execute; must not be nullReturns the expression executed by this statement.
Sets the expression executed by this statement.
expression - the ExpressionCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.