code: private AbstractScope<?, ?> instantiateScopes(int count) {
      checkArgument(count <= scopeRoots.size());
      AbstractScope<?, ?> scope = scopes.peek();
  
      for (int i = 0; i < count; i++) {
        scope = scopeCreator.createScope(scopeRoots.get(i), scope);
        scopes.push(scope);
      }
      scopeRoots.subList(0, count).clear();
      return scope;
    }
docs: Instantiate some, but not necessarily all, scopes from stored roots.
  
  <p>NodeTraversal instantiates scopes lazily when getScope() or similar is called, by iterating
  over a stored list of not-yet-instantiated scopeRoots.  When a not-yet-instantiated parent
  scope is requested, it doesn't make sense to instantiate <i>all</i> pending scopes.  Instead,
  we count the number that are needed to ensure the requested parent is instantiated and call
  this function to instantiate only as many scopes as are needed, shifting their roots off the
  queue, and returning the deepest scope actually created.