private static boolean closableBlockExpressionsAreEquivalent(
     GrClosableBlock closableBlock1, GrClosableBlock closableBlock2) {
   final GrStatement[] statements1 = closableBlock1.getStatements();
   final GrStatement[] statements2 = closableBlock2.getStatements();
   if (statements1.length != statements2.length) {
     return false;
   }
   for (int i = 0; i < statements1.length; i++) {
     if (!statementsAreEquivalent(statements1[i], statements2[i])) {
       return false;
     }
   }
   return true;
 }
  private void buildFlowForClosure(final GrClosableBlock closure) {
    for (GrParameter parameter : closure.getAllParameters()) {
      if (myPolicy.isVariableInitialized(parameter)) {
        addNode(new ReadWriteVariableInstruction(parameter.getName(), parameter, WRITE));
      }
    }

    addNode(new ReadWriteVariableInstruction("owner", closure.getLBrace(), WRITE));

    PsiElement child = closure.getFirstChild();
    while (child != null) {
      if (child instanceof GroovyPsiElement) {
        ((GroovyPsiElement) child).accept(this);
      }
      child = child.getNextSibling();
    }

    final GrStatement[] statements = closure.getStatements();
    if (statements.length > 0) {
      handlePossibleReturn(statements[statements.length - 1]);
    }
  }