GrExpression (int index) { if (myActualArgs == null || myActualArgs[index] == null) { final GrExpression[] arguments = myContext.getArgumentList().getExpressionArguments(); if (index < arguments.length) return arguments[index]; index -= arguments.length; final GrClosableBlock[] closureArguments = myContext.getClosureArguments(); if (index < closureArguments.length) return closureArguments[index]; throw new IncorrectOperationException("fail :("); } final GrClosureSignatureUtil.ArgInfo<PsiElement> argInfo = myActualArgs[index]; final List<PsiElement> args = argInfo.args; if (argInfo.isMultiArg) { return GroovyRefactoringUtil.generateArgFromMultiArg(mySignature.getSubstitutor(), args, myParameters[index].getType(), myContext.getProject()); } else if (args.isEmpty()) { final PsiParameter parameter = myParameters[index]; LOG.assertTrue(parameter instanceof GrParameter); final GrExpression initializer = ((GrParameter)parameter).getInitializerGroovy(); LOG.assertTrue(initializer != null); return (GrExpression)initializer.copy(); } else { return (GrExpression)args.get(0); } }