Ejemplo n.º 1
0
 @Override
 public void see(Block block, String name, Commands cmds, Identifiers succ, Block tail) {
   currentBlock = block;
   if (succ != null) succ.eval(this);
   currentBlock = null;
   if (tail != null) tail.eval(this);
 }
Ejemplo n.º 2
0
  @Override
  public void see(Implementation implementation, Signature sig, Body body, Declaration tail) {
    // initialize graph
    currentFlowGraph = new SimpleGraph<Block>();
    flowGraphs.put(implementation, currentFlowGraph);

    // get blocks by name
    blocksByName = new HashMap<String, Block>();
    Block b = body.getBlocks();
    while (b != null) {
      blocksByName.put(b.getName(), b);
      currentFlowGraph.node(b);
      b = b.getTail();
    }

    // build graph
    body.eval(this);

    // check for reachability
    seenBlocks = new HashSet<Block>();
    b = body.getBlocks();
    if (b == null) return;
    dfs(b);
    while (b != null) {
      if (!seenBlocks.contains(b))
        Err.warning("" + b.loc() + ": Block " + b.getName() + " is unreachable.");
      b = b.getTail();
    }

    if (tail != null) tail.eval(this);
  }