public Expression transformRangeExpression(RangeExpression range) { final ClassNode inferred = range.getNodeMetaData(StaticTypesMarker.INFERRED_TYPE); if (INTRANGE_TYPE.equals(inferred)) { ArgumentListExpression bounds = new ArgumentListExpression( new ConstantExpression(range.isInclusive(), true), range.getFrom(), range.getTo()); ConstructorCallExpression cce = new ConstructorCallExpression(INTRANGE_TYPE, bounds); cce.setSourcePosition(range); cce.putNodeMetaData(StaticTypesMarker.DIRECT_METHOD_CALL_TARGET, INTRANGE_CTOR); cce.putNodeMetaData(StaticTypesMarker.INFERRED_TYPE, INTRANGE_TYPE); return transformer.transform(cce); } return transformer.superTransform(range); }
@Override public void visitRangeExpression(RangeExpression expression) { // LOG.debug "Transforming expression '${expression}':" if (expression.getLineNumber() >= 0 && expression.getLineNumber() < lineNumbers.length) { // LOG.debug " start from ${expression.lineNumber} to ${lineNumbers[expression.lineNumber // - 1]}" expression.setLineNumber(lineNumbers[expression.getLineNumber() - 1]); } if (expression.getLastLineNumber() > 0 && expression.getLastLineNumber() < lineNumbers.length) { // LOG.debug " end from ${expression.lastLineNumber} to // ${lineNumbers[expression.lastLineNumber - 1]}" expression.setLastLineNumber(lineNumbers[expression.getLastLineNumber() - 1]); } super.visitRangeExpression(expression); }
public void visitRangeExpression(RangeExpression expression) { expression.getFrom().visit(this); expression.getTo().visit(this); }