private PsiElement inlineParam(PsiElement newExpr, GrExpression actualArg, PsiParameter parameter) {
    if (myParamsToNotInline.contains(parameter)) return newExpr;

    GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(myProject);

    if (myExpr instanceof GrClosableBlock) {
      int count = 0;
      for (PsiReference reference : ReferencesSearch.search(parameter, new LocalSearchScope(myParameterInitializer))) {
        count++;
        if (count > 1) break;
      }
      if (count > 1) {
        myParamsToNotInline.add(parameter);

        final PsiType type;
        if (parameter instanceof GrParameter) {
          type = ((GrParameter)parameter).getDeclaredType();
        }
        else {
          type = parameter.getType();
        }
        final GrVariableDeclaration declaration =
          factory.createVariableDeclaration(ArrayUtilRt.EMPTY_STRING_ARRAY, actualArg, type, parameter.getName());

        final GrStatement[] statements = ((GrClosableBlock)myExpr).getStatements();
        GrStatement anchor = statements.length > 0 ? statements[0] : null;
        return ((GrClosableBlock)myExpr).addStatementBefore(declaration, anchor);
      }
    }


    int copyingSafetyLevel = GroovyRefactoringUtil.verifySafeCopyExpression(actualArg);
    if (copyingSafetyLevel == RefactoringUtil.EXPR_COPY_PROHIBITED) {
      actualArg = factory.createExpressionFromText(getTempVar(actualArg));
    }
    newExpr = newExpr.replace(actualArg);
    return newExpr;
  }
private PsiElement inlineParam(PsiElement newExpr, GrExpression actualArg, PsiParameter parameter)