@@ -45,12 +45,14 @@ import org.apache.groovy.ginq.provider.collection.runtime.ValueBound
4545import org.apache.groovy.ginq.provider.collection.runtime.WindowDefinition
4646import org.apache.groovy.util.Maps
4747import org.codehaus.groovy.GroovyBugError
48+ import org.codehaus.groovy.ast.ClassCodeExpressionTransformer
4849import org.codehaus.groovy.ast.ClassNode
4950import org.codehaus.groovy.ast.CodeVisitorSupport
5051import org.codehaus.groovy.ast.Parameter
5152import org.codehaus.groovy.ast.expr.ArgumentListExpression
5253import org.codehaus.groovy.ast.expr.BinaryExpression
5354import org.codehaus.groovy.ast.expr.CastExpression
55+ import org.codehaus.groovy.ast.expr.ClosureExpression
5456import org.codehaus.groovy.ast.expr.ConstantExpression
5557import org.codehaus.groovy.ast.expr.ConstructorCallExpression
5658import org.codehaus.groovy.ast.expr.DeclarationExpression
@@ -1199,9 +1201,13 @@ class GinqAstWalker implements GinqAstVisitor<Expression>, SyntaxErrorReportable
11991201 // The synthetic lambda parameter `__t` represents the element from the result datasource of joining, e.g. `n1` innerJoin `n2`
12001202 // The element from first datasource(`n1`) is referenced via `_t.v1`
12011203 // and the element from second datasource(`n2`) is referenced via `_t.v2`
1202- expr = ((ListExpression ) (new ListExpression (Collections . singletonList(expr)). transformExpression(new ExpressionTransformer () {
1204+ expr = ((ListExpression ) (new ListExpression (Collections . singletonList(expr)). transformExpression(new ClassCodeExpressionTransformer () {
12031205 @Override
12041206 Expression transform (Expression expression ) {
1207+ if (expression instanceof ClosureExpression ) {
1208+ expression. visit(this )
1209+ return expression
1210+ }
12051211 Expression transformedExpression = correctVars(dataSourceExpression, lambdaParamName, expression)
12061212 if (null == transformedExpression) {
12071213 return expression
@@ -1212,6 +1218,11 @@ class GinqAstWalker implements GinqAstVisitor<Expression>, SyntaxErrorReportable
12121218
12131219 return expression. transformExpression(this )
12141220 }
1221+
1222+ @Override
1223+ SourceUnit getSourceUnit () {
1224+ return sourceUnit;
1225+ }
12151226 }))). getExpression(0 )
12161227
12171228 tuple(declarationExpressionList, expr)
0 commit comments