1 46 package org.codehaus.groovy.ast.stmt; 47 48 import org.codehaus.groovy.ast.GroovyCodeVisitor; 49 import org.codehaus.groovy.ast.expr.Expression; 50 51 52 58 public class ExpressionStatement extends Statement { 59 60 private Expression expression; 61 62 public ExpressionStatement(Expression expression) { 63 if (expression == null) { 64 throw new IllegalArgumentException ("expression cannot be null"); 65 } 66 this.expression = expression; 67 } 68 69 public void visit(GroovyCodeVisitor visitor) { 70 visitor.visitExpressionStatement(this); 71 } 72 73 public Expression getExpression() { 74 return expression; 75 } 76 77 public void setExpression(Expression expression) { 78 this.expression = expression; 79 } 80 81 public String getText() { 82 return this.toString(); 83 } 84 public String toString() { 85 return super.toString() + "[expression:" + expression + "]"; 86 } 87 88 } 89 | Popular Tags |