Пример #1
0
 /**
  * Creates a new scope (e.g. when entering a function).
  *
  * @param quietly Don't fire an enterScope callback.
  */
 private void pushScope(Scope s, boolean quietly) {
   Preconditions.checkState(curNode != null);
   compiler.setScope(s.getRootNode());
   scopes.push(s);
   if (NodeUtil.isValidCfgRoot(s.getRootNode())) {
     cfgs.push(null);
   }
   if (!quietly && scopeCallback != null) {
     scopeCallback.enterScope(this);
   }
 }
Пример #2
0
 /** Creates a new scope (e.g. when entering a function). */
 private void pushScope(Node node) {
   Preconditions.checkState(curNode != null);
   compiler.setScope(node);
   scopeRoots.push(node);
   if (NodeUtil.isValidCfgRoot(node)) {
     cfgRoots.push(node);
     cfgs.push(null);
   }
   if (scopeCallback != null) {
     scopeCallback.enterScope(this);
   }
 }
Пример #3
0
 /**
  * Pops back to the previous scope (e.g. when leaving a function).
  *
  * @param quietly Don't fire the exitScope callback.
  */
 private void popScope(boolean quietly) {
   if (!quietly && scopeCallback != null) {
     scopeCallback.exitScope(this);
   }
   Node scopeRoot;
   if (scopeRoots.isEmpty()) {
     scopeRoot = scopes.pop().getRootNode();
   } else {
     scopeRoot = scopeRoots.pop();
   }
   if (NodeUtil.isValidCfgRoot(scopeRoot)) {
     cfgs.pop();
     if (!cfgRoots.isEmpty()) {
       Preconditions.checkState(cfgRoots.pop() == scopeRoot);
     }
   }
   if (hasScope()) {
     compiler.setScope(getScopeRoot());
   }
 }