PsiElement (PsiGenerationInfo<PsiMethod> info, PsiClass targetClass) { PsiElement parent = targetClass instanceof GroovyScriptClass ? ((GroovyScriptClass)targetClass).getContainingFile() : targetClass; if (PsiTreeUtil.isAncestor(parent, getRefExpr(), false)) { return info.findInsertionAnchor(targetClass, getRefExpr()); } else { return null; } }