Exemplo n.º 1
0
 public ExceptionChecker push() {
   throwsSet(); // force an instantiation of the throwsset.
   ExceptionChecker ec = (ExceptionChecker) this.shallowCopy();
   ec.outer = this;
   ec.catchable = null;
   ec.catchAllThrowable = false;
   return ec;
 }
Exemplo n.º 2
0
  /**
   * Here, we pop the stack frame that we pushed in enter and agregate the exceptions.
   *
   * @param old The original state of root of the current subtree.
   * @param n The current state of the root of the current subtree.
   * @param v The <code>NodeVisitor</code> object used to visit the children.
   * @return The final result of the traversal of the tree rooted at <code>n</code>.
   */
  protected Node leaveCall(Node old, Node n, NodeVisitor v) throws SemanticException {

    ExceptionChecker inner = (ExceptionChecker) v;

    if (inner.outer != this) throw new InternalCompilerError("oops!");

    // gather exceptions from this node.
    n = n.del().exceptionCheck(inner);

    // Merge results from the children and free the checker used for the
    // children.
    SubtypeSet t = inner.throwsSet();
    throwsSet().addAll(t);
    exceptionPositions.putAll(inner.exceptionPositions);

    return n;
  }
Exemplo n.º 3
0
 public ExceptionChecker pushCatchAllThrowable() {
   ExceptionChecker ec = this.push();
   ec.throwsSet = new SubtypeSet(ts.CheckedThrowable());
   ec.catchAllThrowable = true;
   return ec;
 }
Exemplo n.º 4
0
 public ExceptionChecker push(Collection<Type> catchableTypes) {
   ExceptionChecker ec = this.push();
   ec.catchable = CollectionFactory.newHashSet(catchableTypes);
   ec.throwsSet = new SubtypeSet(ts.CheckedThrowable());
   return ec;
 }
Exemplo n.º 5
0
 public ExceptionChecker push(Type catchableType) {
   ExceptionChecker ec = this.push();
   ec.catchable = Collections.<Type>singleton(catchableType);
   ec.throwsSet = new SubtypeSet(ts.CheckedThrowable());
   return ec;
 }
Exemplo n.º 6
0
 public ExceptionChecker push(UncaughtReporter reporter) {
   ExceptionChecker ec = this.push();
   ec.reporter = reporter;
   ec.throwsSet = new SubtypeSet(ts.CheckedThrowable());
   return ec;
 }