private boolean isNewifyCandidate(MethodCallExpression mce) { return mce.getObjectExpression() == VariableExpression.THIS_EXPRESSION || (auto && isNewMethodStyle(mce)); }
private Expression transformMethodCall(MethodCallExpression mce, Expression argsExp) { ClassNode classType; if (isNewMethodStyle(mce)) { classType = mce.getObjectExpression().getType(); } else { classType = findMatchingCandidateClass(mce); } if (classType != null) { Expression argsToUse = argsExp; if (classType.getOuterClass() != null && ((classType.getModifiers() & org.objectweb.asm.Opcodes.ACC_STATIC) == 0)) { if (!(argsExp instanceof ArgumentListExpression)) { addError("Non-static inner constructor arguments must be an argument list expression; pass 'this' pointer explicitely as first constructor argument otherwise.", mce); return mce; } final ArgumentListExpression argsListExp = (ArgumentListExpression) argsExp; final List<Expression> argExpList = argsListExp.getExpressions(); final VariableExpression thisVarExp = new VariableExpression("this"); final List<Expression> expressionsWithThis = new ArrayList<Expression>(argExpList.size() + 1); expressionsWithThis.add(thisVarExp); expressionsWithThis.addAll(argExpList); argsToUse = new ArgumentListExpression(expressionsWithThis); } return new ConstructorCallExpression(classType, argsToUse); } // set the args as they might have gotten Newify transformed GROOVY-3491 mce.setArguments(argsExp); return mce; }
private boolean isNewifyCandidate(MethodCallExpression mce) { return mce.getObjectExpression() == VariableExpression.THIS_EXPRESSION || (auto && isNewMethodStyle(mce)); }
private boolean isNewifyCandidate(MethodCallExpression mce) { return mce.getObjectExpression() == VariableExpression.THIS_EXPRESSION || (auto && isNewMethodStyle(mce)); }
private boolean isNewifyCandidate(MethodCallExpression mce) { return mce.getObjectExpression() == VariableExpression.THIS_EXPRESSION || (auto && isNewMethodStyle(mce)); }
private Expression transformMethodCall(MethodCallExpression mce, Expression args) { ClassNode classType; if (isNewMethodStyle(mce)) { classType = mce.getObjectExpression().getType(); } else { classType = findMatchingCandidateClass(mce); } if (classType != null) { return new ConstructorCallExpression(classType, args); } // set the args as they might have gotten Newify transformed GROOVY-3491 mce.setArguments(args); return mce; }
private Expression transformMethodCall(MethodCallExpression mce, Expression args) { ClassNode classType; if (isNewMethodStyle(mce)) { classType = mce.getObjectExpression().getType(); } else { classType = findMatchingCandidateClass(mce); } if (classType != null) { return new ConstructorCallExpression(classType, args); } // set the args as they might have gotten Newify transformed GROOVY-3491 mce.setArguments(args); return mce; }
private Expression transformMethodCall(MethodCallExpression mce, Expression args) { ClassNode classType; if (isNewMethodStyle(mce)) { classType = mce.getObjectExpression().getType(); } else { classType = findMatchingCandidateClass(mce); } if (classType != null) { return new ConstructorCallExpression(classType, args); } // set the args as they might have gotten Newify transformed GROOVY-3491 mce.setArguments(args); return mce; }