コード例 #1
0
  private static void addEdge(InstructionImpl begin, InstructionImpl end) {
    begin.addSuccessor(end);
    end.addPredecessor(begin);

    if (!(begin instanceof ReadWriteVariableInstruction || begin instanceof MixinTypeInstruction)) {
      end.addNegationsFrom(begin);
    }
  }
コード例 #2
0
 @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;
 }
コード例 #3
0
 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);
   }
 }
コード例 #4
0
  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();
  }
コード例 #5
0
 private void finishNode(InstructionImpl instruction) {
   final InstructionImpl popped = myProcessingStack.pop();
   if (!instruction.equals(popped)) {
     String description =
         "popped: "
             + popped.toString()
             + " : "
             + popped.hashCode()
             + "   ,  expected: "
             + instruction.toString()
             + " : "
             + instruction.hashCode();
     error(description);
   }
 }