1 46 package org.codehaus.groovy.ast.expr; 47 48 import groovy.lang.Range; 49 50 import org.codehaus.groovy.ast.GroovyCodeVisitor; 51 import org.codehaus.groovy.classgen.AsmClassGenerator2; 52 53 61 public class RangeExpression extends Expression { 62 63 private Expression from; 64 private Expression to; 65 private boolean inclusive; 66 67 public RangeExpression(Expression from, Expression to, boolean inclusive) { 68 this.from = from; 69 this.to = to; 70 this.inclusive = inclusive; 71 } 72 73 public void visit(GroovyCodeVisitor visitor) { 74 visitor.visitRangeExpression(this); 75 } 76 77 public Expression transformExpression(ExpressionTransformer transformer) { 78 return new RangeExpression(transformer.transform(from), transformer.transform(to), inclusive); 79 } 80 81 protected void resolveType(AsmClassGenerator2 resolver) { 82 from.resolve(resolver); 83 to.resolve(resolver); 84 super.setTypeClass(Range.class); 85 } 86 87 public Expression getFrom() { 88 return from; 89 } 90 91 public Expression getTo() { 92 return to; 93 } 94 95 public boolean isInclusive() { 96 return inclusive; 97 } 98 99 } 100 | Popular Tags |