@NonNls
  @NotNull
  private CharSequence getOwner(@NotNull GrClosableBlock closure) {
    final GroovyPsiElement context = PsiTreeUtil.getParentOfType(closure, GrMember.class, GroovyFile.class);
    LOG.assertTrue(context != null);

    final PsiClass contextClass;
    if (context instanceof GroovyFile) {
      contextClass = ((GroovyFile)context).getScriptClass();
    }
    else if (context instanceof PsiClass) {
      contextClass = (PsiClass)context;
    }
    else if (context instanceof GrMember) {
      if (((GrMember)context).hasModifierProperty(PsiModifier.STATIC)) {
        contextClass = null; //no context class
      }
      else {
        contextClass = ((GrMember)context).getContainingClass();
      }
    }
    else {
      contextClass = null;
    }

    if (contextClass == null) return "null";

    final PsiElement implicitClass = GenerationUtil.getWrappingImplicitClass(closure);
    if (implicitClass == null) {
      return "this";
    }
    else {
      final StringBuilder buffer = new StringBuilder();
      GenerationUtil.writeThisReference(contextClass, buffer, this.context);
      return buffer;
    }
  }
@NonNls
  @NotNull
  private CharSequence getOwner(@NotNull GrClosableBlock closure)