public void visitConstructorCallExpression(ConstructorCallExpression call) { isSpecialConstructorCall = call.isSpecialCall(); super.visitConstructorCallExpression(call); isSpecialConstructorCall = false; if (!call.isUsingAnonymousInnerClass()) return; pushState(); InnerClassNode innerClass = (InnerClassNode) call.getType(); innerClass.setVariableScope(currentScope); for (MethodNode method : innerClass.getMethods()) { Parameter[] parameters = method.getParameters(); if (parameters.length == 0) parameters = null; // null means no implicit "it" ClosureExpression cl = new ClosureExpression(parameters, method.getCode()); visitClosureExpression(cl); } for (FieldNode field : innerClass.getFields()) { final Expression expression = field.getInitialExpression(); if (expression != null) { expression.visit(this); } } for (Statement statement : innerClass.getObjectInitializerStatements()) { statement.visit(this); } markClosureSharedVariables(); popState(); }
protected Expression transformConstructorCallExpression(ConstructorCallExpression cce) { inSpecialConstructorCall = cce.isSpecialCall(); Expression expression = cce.getArguments(); if (expression instanceof TupleExpression) { TupleExpression tuple = (TupleExpression) expression; if (tuple.getExpressions().size() == 1) { expression = tuple.getExpression(0); if (expression instanceof NamedArgumentListExpression) { NamedArgumentListExpression namedArgs = (NamedArgumentListExpression) expression; List<MapEntryExpression> entryExpressions = namedArgs.getMapEntryExpressions(); for (int i = 0; i < entryExpressions.size(); i++) { entryExpressions.set( i, (MapEntryExpression) transformMapEntryExpression(entryExpressions.get(i), cce.getType())); } } } } Expression ret = cce.transformExpression(this); inSpecialConstructorCall = false; return ret; }