boolean (GrStatement[] statements) { final GrStatement statement0 = statements[0]; PsiElement returnFrom = PsiTreeUtil.getParentOfType(statement0, GrMethod.class, GrClosableBlock.class, GroovyFile.class); if (returnFrom instanceof GrMethod) { returnFrom = ((GrMethod)returnFrom).getBlock(); } LOG.assertTrue(returnFrom instanceof GrStatementOwner); final GrStatement[] blockStatements = ((GrStatementOwner)returnFrom).getStatements(); final GrStatement lastFromBlock = ArrayUtil.getLastElement(blockStatements); final GrStatement lastStatement = ArrayUtil.getLastElement(statements); return statement0.getManager().areElementsEquivalent(lastFromBlock, lastStatement); }