コード例 #1
0
 private <T extends InstructionImpl> T addNode(T instruction) {
   instruction.setNumber(myInstructionNumber++);
   myInstructions.add(instruction);
   if (myHead != null) {
     addEdge(myHead, instruction);
   }
   myHead = instruction;
   return instruction;
 }
コード例 #2
0
  private List<GotoInstruction> collectAndRemoveAllPendingNegations(GroovyPsiElement currentScope) {
    List<GotoInstruction> negations = new ArrayList<GotoInstruction>();
    for (Iterator<Pair<InstructionImpl, GroovyPsiElement>> iterator = myPending.iterator();
        iterator.hasNext(); ) {
      Pair<InstructionImpl, GroovyPsiElement> pair = iterator.next();
      InstructionImpl instruction = pair.first;
      GroovyPsiElement scope = pair.second;

      if (!PsiTreeUtil.isAncestor(scope, currentScope, true)
          && instruction instanceof GotoInstruction) {
        negations.add((GotoInstruction) instruction);
        iterator.remove();
      }
    }
    return negations;
  }