boolean (GrCallExpression call) { GrStatement stmt = call; PsiElement parent = call.getParent(); // return statement if (parent instanceof GrReturnStatement) { stmt = ((GrReturnStatement) parent); parent = parent.getParent(); } // method body result if (parent instanceof GrOpenBlock) { if (parent.getParent() instanceof GrMethod) { GrStatement[] statements = ((GrOpenBlock) parent).getStatements(); return statements.length > 0 && stmt == statements[statements.length - 1]; } } // closure result if (parent instanceof GrClosableBlock) { GrStatement[] statements = ((GrClosableBlock) parent).getStatements(); return statements.length > 0 && stmt == statements[statements.length - 1]; } // todo add for inner method block statements // todo test me! if (stmt instanceof GrReturnStatement) { GrMethod method = PsiTreeUtil.getParentOfType(stmt, GrMethod.class); if (method != null) { Collection<GrStatement> returnStatements = ControlFlowUtils.collectReturns(method.getBlock()); return returnStatements.contains(stmt) && !hasBadReturns(method); } } return false; }