groovy git commit: Minor refactoring

2017-07-27 Thread sunlan
Repository: groovy
Updated Branches:
  refs/heads/master c3d12bb6a -> 13e4a522c


Minor refactoring


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/13e4a522
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/13e4a522
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/13e4a522

Branch: refs/heads/master
Commit: 13e4a522c44f3c0ff337f3ee949aa87d443ca64d
Parents: c3d12bb
Author: sunlan 
Authored: Thu Jul 27 23:23:45 2017 +0800
Committer: sunlan 
Committed: Thu Jul 27 23:24:15 2017 +0800

--
 .../apache/groovy/parser/antlr4/AstBuilder.java | 71 ++--
 1 file changed, 21 insertions(+), 50 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/13e4a522/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
--
diff --git 
a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
 
b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index 6a10aff..ce83274 100644
--- 
a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ 
b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -2455,13 +2455,7 @@ public class AstBuilder extends 
GroovyParserBaseVisitor implements Groov
 
 @Override
 public BinaryExpression visitPowerExprAlt(PowerExprAltContext ctx) {
-BinaryExpression binaryExpression = 
this.createBinaryExpression(ctx.left, ctx.op, ctx.right);
-
-if (isTrue(ctx, IS_INSIDE_CONDITIONAL_EXPRESSION)) {
-return this.configureAST(binaryExpression, ctx.op);
-}
-
-return this.configureAST(binaryExpression, ctx);
+return this.createBinaryExpression(ctx.left, ctx.op, ctx.right, ctx);
 }
 
 @Override
@@ -2510,24 +2504,12 @@ public class AstBuilder extends 
GroovyParserBaseVisitor implements Groov
 
 @Override
 public BinaryExpression 
visitMultiplicativeExprAlt(MultiplicativeExprAltContext ctx) {
-BinaryExpression binaryExpression = 
this.createBinaryExpression(ctx.left, ctx.op, ctx.right);
-
-if (isTrue(ctx, IS_INSIDE_CONDITIONAL_EXPRESSION)) {
-return this.configureAST(binaryExpression, ctx.op);
-}
-
-return this.configureAST(binaryExpression, ctx);
+return this.createBinaryExpression(ctx.left, ctx.op, ctx.right, ctx);
 }
 
 @Override
 public BinaryExpression visitAdditiveExprAlt(AdditiveExprAltContext ctx) {
-BinaryExpression binaryExpression = 
this.createBinaryExpression(ctx.left, ctx.op, ctx.right);
-
-if (isTrue(ctx, IS_INSIDE_CONDITIONAL_EXPRESSION)) {
-return this.configureAST(binaryExpression, ctx.op);
-}
-
-return this.configureAST(binaryExpression, ctx);
+return this.createBinaryExpression(ctx.left, ctx.op, ctx.right, ctx);
 }
 
 @Override
@@ -2585,17 +2567,14 @@ public class AstBuilder extends 
GroovyParserBaseVisitor implements Groov
 case GT:
 case LT:
 case IN:
-case NOT_IN:
-{
-BinaryExpression binaryExpression = 
this.createBinaryExpression(ctx.left, ctx.op, ctx.right);
-
+case NOT_IN: {
 if (ctx.op.getType() == IN || ctx.op.getType() == NOT_IN ) {
-if (isTrue(ctx, IS_INSIDE_CONDITIONAL_EXPRESSION)) {
-return this.configureAST(binaryExpression, ctx.op);
-}
+return this.createBinaryExpression(ctx.left, ctx.op, 
ctx.right, ctx);
 }
 
-return this.configureAST(binaryExpression, ctx);
+return this.configureAST(
+this.createBinaryExpression(ctx.left, ctx.op, 
ctx.right),
+ctx);
 }
 
 default:
@@ -2619,35 +2598,17 @@ public class AstBuilder extends 
GroovyParserBaseVisitor implements Groov
 
 @Override
 public BinaryExpression visitAndExprAlt(AndExprAltContext ctx) {
-BinaryExpression binaryExpression = 
this.createBinaryExpression(ctx.left, ctx.op, ctx.right);
-
-if (isTrue(ctx, IS_INSIDE_CONDITIONAL_EXPRESSION)) {
-return this.configureAST(binaryExpression, ctx.op);
-}
-
-return this.configureAST(binaryExpression, ctx);
+return this.createBinaryExpression(ctx.left, ctx.op, ctx.right, ctx);
 }
 
 @Override
 public BinaryExpression visitExclusiveOrExprAlt(ExclusiveOrExprAltContext 
ctx) {
-BinaryExpression binaryExpression = 
this.createBinaryExpression(ctx.left, ctx.op, ctx.right);
-
-if (isTrue(ctx, 

groovy git commit: Minor refactoring

2017-07-27 Thread sunlan
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 16b281087 -> 93f410813


Minor refactoring

(cherry picked from commit 13e4a52)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/93f41081
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/93f41081
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/93f41081

Branch: refs/heads/GROOVY_2_6_X
Commit: 93f410813918f78e1c033f02faeb5699a8244d9a
Parents: 16b2810
Author: sunlan 
Authored: Thu Jul 27 23:23:45 2017 +0800
Committer: sunlan 
Committed: Thu Jul 27 23:26:35 2017 +0800

--
 .../apache/groovy/parser/antlr4/AstBuilder.java | 71 ++--
 1 file changed, 21 insertions(+), 50 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/93f41081/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
--
diff --git 
a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
 
b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index 750e4f8..4437ad6 100644
--- 
a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ 
b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -2476,13 +2476,7 @@ public class AstBuilder extends 
GroovyParserBaseVisitor implements Groov
 
 @Override
 public BinaryExpression visitPowerExprAlt(PowerExprAltContext ctx) {
-BinaryExpression binaryExpression = 
this.createBinaryExpression(ctx.left, ctx.op, ctx.right);
-
-if (isTrue(ctx, IS_INSIDE_CONDITIONAL_EXPRESSION)) {
-return this.configureAST(binaryExpression, ctx.op);
-}
-
-return this.configureAST(binaryExpression, ctx);
+return this.createBinaryExpression(ctx.left, ctx.op, ctx.right, ctx);
 }
 
 @Override
@@ -2531,24 +2525,12 @@ public class AstBuilder extends 
GroovyParserBaseVisitor implements Groov
 
 @Override
 public BinaryExpression 
visitMultiplicativeExprAlt(MultiplicativeExprAltContext ctx) {
-BinaryExpression binaryExpression = 
this.createBinaryExpression(ctx.left, ctx.op, ctx.right);
-
-if (isTrue(ctx, IS_INSIDE_CONDITIONAL_EXPRESSION)) {
-return this.configureAST(binaryExpression, ctx.op);
-}
-
-return this.configureAST(binaryExpression, ctx);
+return this.createBinaryExpression(ctx.left, ctx.op, ctx.right, ctx);
 }
 
 @Override
 public BinaryExpression visitAdditiveExprAlt(AdditiveExprAltContext ctx) {
-BinaryExpression binaryExpression = 
this.createBinaryExpression(ctx.left, ctx.op, ctx.right);
-
-if (isTrue(ctx, IS_INSIDE_CONDITIONAL_EXPRESSION)) {
-return this.configureAST(binaryExpression, ctx.op);
-}
-
-return this.configureAST(binaryExpression, ctx);
+return this.createBinaryExpression(ctx.left, ctx.op, ctx.right, ctx);
 }
 
 @Override
@@ -2606,17 +2588,14 @@ public class AstBuilder extends 
GroovyParserBaseVisitor implements Groov
 case GT:
 case LT:
 case IN:
-case NOT_IN:
-{
-BinaryExpression binaryExpression = 
this.createBinaryExpression(ctx.left, ctx.op, ctx.right);
-
+case NOT_IN: {
 if (ctx.op.getType() == IN || ctx.op.getType() == NOT_IN ) {
-if (isTrue(ctx, IS_INSIDE_CONDITIONAL_EXPRESSION)) {
-return this.configureAST(binaryExpression, ctx.op);
-}
+return this.createBinaryExpression(ctx.left, ctx.op, 
ctx.right, ctx);
 }
 
-return this.configureAST(binaryExpression, ctx);
+return this.configureAST(
+this.createBinaryExpression(ctx.left, ctx.op, 
ctx.right),
+ctx);
 }
 
 default:
@@ -2640,35 +2619,17 @@ public class AstBuilder extends 
GroovyParserBaseVisitor implements Groov
 
 @Override
 public BinaryExpression visitAndExprAlt(AndExprAltContext ctx) {
-BinaryExpression binaryExpression = 
this.createBinaryExpression(ctx.left, ctx.op, ctx.right);
-
-if (isTrue(ctx, IS_INSIDE_CONDITIONAL_EXPRESSION)) {
-return this.configureAST(binaryExpression, ctx.op);
-}
-
-return this.configureAST(binaryExpression, ctx);
+return this.createBinaryExpression(ctx.left, ctx.op, ctx.right, ctx);
 }
 
 @Override
 public BinaryExpression visitExclusiveOrExprAlt(ExclusiveOrExprAltContext 
ctx) {
-BinaryExpression binaryExpression =