Exemplo n.º 1
0
 /**
  * Visitor method: enter all classes in given tree, catching any completion failure exceptions.
  * Return the tree's type.
  *
  * @param tree The tree to be visited.
  * @param env The environment visitor argument.
  */
 Type classEnter(JCTree tree, Env<AttrContext> env) {
   Env<AttrContext> prevEnv = this.env;
   try {
     this.env = env;
     tree.accept(this);
     return result;
   } catch (CompletionFailure ex) {
     return chk.completionError(tree.pos(), ex);
   } finally {
     this.env = prevEnv;
   }
 }
 private List<ClassSymbol> getTopLevelClasses(List<? extends JCCompilationUnit> units) {
   List<ClassSymbol> classes = List.nil();
   for (JCCompilationUnit unit : units) {
     for (JCTree node : unit.defs) {
       if (node.getTag() == JCTree.CLASSDEF) {
         ClassSymbol sym = ((JCClassDecl) node).sym;
         Assert.checkNonNull(sym);
         classes = classes.prepend(sym);
       }
     }
   }
   return classes.reverse();
 }
 public void scan(JCTree node) {
   super.scan(node);
   if (node != null) node.type = null;
 }