private void checkPending(@NotNull InstructionImpl instruction) { final PsiElement element = instruction.getElement(); List<Pair<InstructionImpl, GroovyPsiElement>> target = collectCorrespondingPendingEdges(element); for (Pair<InstructionImpl, GroovyPsiElement> pair : target) { addEdge(pair.getFirst(), instruction); } }
@Nullable private InstructionImpl findInstruction(PsiElement element) { final Iterator<InstructionImpl> iterator = myProcessingStack.descendingIterator(); while (iterator.hasNext()) { final InstructionImpl instruction = iterator.next(); if (element.equals(instruction.getElement())) return instruction; } return null; }
public void visitReturnStatement(GrReturnStatement returnStatement) { boolean isNodeNeeded = myHead == null || myHead.getElement() != returnStatement; final GrExpression value = returnStatement.getReturnValue(); if (value != null) value.accept(this); if (isNodeNeeded) { InstructionImpl returnInstruction = startNode(returnStatement); addPendingEdge(null, myHead); finishNode(returnInstruction); } else { addPendingEdge(null, myHead); } interruptFlow(); }