Ejemplo n.º 1
0
 /**
  * Traverses a parse tree recursively with a scope, starting with the given root. This should only
  * be used in the global scope. Otherwise, use {@link #traverseAtScope}.
  */
 void traverseWithScope(Node root, Scope s) {
   Preconditions.checkState(s.isGlobal());
   try {
     inputId = null;
     sourceName = "";
     curNode = root;
     pushScope(s);
     traverseBranch(root, null);
     popScope();
   } catch (Exception unexpectedException) {
     throwUnexpectedException(unexpectedException);
   }
 }
Ejemplo n.º 2
0
 /** Traverses a parse tree recursively. */
 public void traverse(Node root) {
   try {
     inputId = NodeUtil.getInputId(root);
     sourceName = "";
     curNode = root;
     pushScope(root);
     // null parent ensures that the shallow callbacks will traverse root
     traverseBranch(root, null);
     popScope();
   } catch (Exception unexpectedException) {
     throwUnexpectedException(unexpectedException);
   }
 }
Ejemplo n.º 3
0
  void traverseRoots(Node externs, Node root) {
    try {
      Node scopeRoot = externs.getParent();
      Preconditions.checkState(scopeRoot != null);

      inputId = NodeUtil.getInputId(scopeRoot);
      sourceName = "";
      curNode = scopeRoot;
      pushScope(scopeRoot);

      traverseBranch(externs, scopeRoot);
      Preconditions.checkState(root.getParent() == scopeRoot);
      traverseBranch(root, scopeRoot);

      popScope();
    } catch (Exception unexpectedException) {
      throwUnexpectedException(unexpectedException);
    }
  }