@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; }
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]); } }