Exemplo n.º 1
0
  public Node leaveCall(Node old, Node n, NodeVisitor v) {
    // check for reachability.
    if (n instanceof Term) {
      n = checkReachability((Term) n);
      Boolean reachable = ((Term) n).reachable();
      if (!hadCFG_Error && (reachable == null || !reachable)) {
        // Do we throw an exception or not?

        // Compound statements are allowed to be unreachable
        // (e.g., "{ return; }" or "while (true) S").  If a compound
        // statement is truly unreachable, one of its sub-statements
        // will be also and we will report an error there.

        if ((n instanceof Block && ((Block) n).statements().isEmpty())
            || (n instanceof Stmt && !(n instanceof CompoundStmt))) {
          reportError(new Errors.UnreachableStatement(n.position()));
        }
      }
    }

    return super.leaveCall(old, n, v);
  }
 private QQ createQQ(Node node) {
   return new QQ(sjts.extensionInfo(), node.position());
 }