boolean (Instruction last, Instruction first, boolean[] visited, ExitPointVisitor visitor) { if (first == last) return true; var shift = first.num(); if (last instanceof AfterCallInstruction) { visited[last.num() - shift] = true; return visitAllExitPointsInner(((AfterCallInstruction)last).myCall, first, visited, visitor); } if (last instanceof MaybeInterruptInstruction) { return visitor.visitExitPoint(last, (GrExpression)last.getElement()); } else if (last instanceof IfEndInstruction) { visited[last.num() - shift] = true; for (Instruction instruction : last.allPredecessors()) { if (!visitAllExitPointsInner(instruction, first, visited, visitor)) return false; } return true; } else if (last instanceof ThrowingInstruction) { PsiElement element = last.getElement(); if (!(element instanceof GrThrowStatement || element instanceof GrAssertStatement)) return true; } PsiElement element = last.getElement(); if (element != null) { final GrExpression returnValue; if (element instanceof GrReturnStatement) { returnValue = ((GrReturnStatement)element).getReturnValue(); } else if (element instanceof GrExpression && PsiUtil.isExpressionStatement(element)) { returnValue = (GrExpression)element; } else { returnValue = null; } return visitor.visitExitPoint(last, returnValue); } visited[last.num() - shift] = true; for (Instruction pred : last.allPredecessors()) { if (!visited[pred.num() - shift]) { if (!visitAllExitPointsInner(pred, first, visited, visitor)) return false; } } return true; }