1 46 package org.codehaus.groovy.ast.expr; 47 48 import org.codehaus.groovy.ast.GroovyCodeVisitor; 49 import org.codehaus.groovy.classgen.AsmClassGenerator2; 50 51 57 public class CastExpression extends Expression { 58 59 private Expression expression; 60 61 public CastExpression(String type, Expression expression) { 62 super.setType(type); 63 this.expression = expression; 64 } 65 66 public String toString() { 67 return super.toString() +"[(" + type + ") " + expression + "]"; 68 } 69 70 public void visit(GroovyCodeVisitor visitor) { 71 visitor.visitCastExpression(this); 72 } 73 74 public Expression transformExpression(ExpressionTransformer transformer) { 75 return new CastExpression(type, transformer.transform(expression)); 76 } 77 78 public String getText() { 79 return "(" + type + ") " + expression.getText(); 80 } 81 82 public Expression getExpression() { 83 return expression; 84 } 85 86 protected void resolveType(AsmClassGenerator2 resolver) { 87 } 89 } 90 | Popular Tags |