1 46 package org.codehaus.groovy.ast.expr; 47 48 import org.codehaus.groovy.ast.GroovyCodeVisitor; 49 import org.codehaus.groovy.classgen.AsmClassGenerator2; 50 import org.codehaus.groovy.syntax.Token; 51 52 58 public class PostfixExpression extends Expression { 59 60 private Token operation; 61 private Expression expression; 62 63 public PostfixExpression(Expression expression, Token operation) { 64 this.operation = operation; 65 this.expression = expression; 66 } 67 68 public String toString() { 69 return super.toString() + "[" + expression + operation + "]"; 70 } 71 72 public void visit(GroovyCodeVisitor visitor) { 73 visitor.visitPostfixExpression(this); 74 } 75 76 public Expression transformExpression(ExpressionTransformer transformer) { 77 return new PostfixExpression(transformer.transform(expression), operation); 78 } 79 80 protected void resolveType(AsmClassGenerator2 resolver) { 81 expression.resolve(resolver); 82 setTypeClass(expression.getTypeClass()); 83 } 84 85 public void setExpression(Expression expression) { 86 this.expression = expression; 87 } 88 89 public Token getOperation() { 90 return operation; 91 } 92 93 public Expression getExpression() { 94 return expression; 95 } 96 97 public String getText() { 98 return "(" + expression.getText() + operation.getText() + ")"; 99 } 100 101 public Class getTypeClass() { 102 return expression.getTypeClass(); 103 } 104 105 public String getType() { 106 return expression.getType(); 107 } 108 109 } 110 | Popular Tags |