This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 4643099  Trivial refactoring: eliminate duplicated code
4643099 is described below

commit 4643099e2edc1ee361e0fa30cfb29596bd22662d
Author: Daniel Sun <[email protected]>
AuthorDate: Sat Dec 19 12:34:31 2020 +0800

    Trivial refactoring: eliminate duplicated code
---
 .../apache/groovy/ginq/provider/collection/GinqAstWalker.groovy  | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git 
a/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/GinqAstWalker.groovy
 
b/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/GinqAstWalker.groovy
index e04fb2e..d043917 100644
--- 
a/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/GinqAstWalker.groovy
+++ 
b/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/GinqAstWalker.groovy
@@ -839,14 +839,11 @@ class GinqAstWalker implements 
GinqAstVisitor<Expression>, SyntaxErrorReportable
                             .collect(Collectors.toList())
         }
 
-        // (1) correct itself
-        expr = correctVars(dataSourceExpression, lambdaParamName, expr) ?: expr
-
-        // (2) correct its children nodes
+        // correct itself and its children nodes
         // The synthetic lambda parameter `__t` represents the element from 
the result datasource of joining, e.g. `n1` innerJoin `n2`
         // The element from first datasource(`n1`) is referenced via `_t.v1`
         // and the element from second datasource(`n2`) is referenced via 
`_t.v2`
-        expr = expr.transformExpression(new ExpressionTransformer() {
+        expr = ((ListExpression) (new 
ListExpression(Collections.singletonList(expr)).transformExpression(new 
ExpressionTransformer() {
             @Override
             Expression transform(Expression expression) {
                 Expression transformedExpression = 
correctVars(dataSourceExpression, lambdaParamName, expression)
@@ -859,7 +856,7 @@ class GinqAstWalker implements GinqAstVisitor<Expression>, 
SyntaxErrorReportable
 
                 return expression.transformExpression(this)
             }
-        })
+        }))).getExpression(0)
 
         return tuple(declarationExpressionList, expr)
     }

Reply via email to