This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git
commit e64215983ea4b7c277eb01a1ed3fcac43976be9c Author: Iiro Kiviluoma <[email protected]> AuthorDate: Sun Apr 11 12:05:17 2021 +0300 GROOVY-9649: Refactored RangeExpression - Old constructor now delegates to the new constructor - Dropped inclusive class variable, isInclusive is handled via right exclusivity. --- .../java/org/codehaus/groovy/ast/expr/RangeExpression.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/ast/expr/RangeExpression.java b/src/main/java/org/codehaus/groovy/ast/expr/RangeExpression.java index a03cecf..b1aba80 100644 --- a/src/main/java/org/codehaus/groovy/ast/expr/RangeExpression.java +++ b/src/main/java/org/codehaus/groovy/ast/expr/RangeExpression.java @@ -29,26 +29,18 @@ import org.codehaus.groovy.ast.GroovyCodeVisitor; public class RangeExpression extends Expression { private final Expression from; private final Expression to; - private final boolean inclusive; // Kept to keep old code depending on this working - // GROOVY-9649 private final boolean exclusiveLeft; private final boolean exclusiveRight; // Kept until sure this can be removed public RangeExpression(Expression from, Expression to, boolean inclusive) { - this.from = from; - this.to = to; - this.inclusive = inclusive; - this.exclusiveLeft = false; - this.exclusiveRight = !inclusive; - setType(ClassHelper.RANGE_TYPE); + this(from, to, false, !inclusive); } // GROOVY-9649 public RangeExpression(Expression from, Expression to, boolean exclusiveLeft, boolean exclusiveRight) { this.from = from; this.to = to; - this.inclusive = !exclusiveRight; // Old code depends on this this.exclusiveLeft = exclusiveLeft; this.exclusiveRight = exclusiveRight; setType(ClassHelper.RANGE_TYPE); @@ -77,7 +69,7 @@ public class RangeExpression extends Expression { } public boolean isInclusive() { - return inclusive; + return !isExclusiveRight(); } public boolean isExclusiveLeft() {
