Finds root scope for specified scope object. Root scope is the top level scope among scope's parents.

@param from
Scope to find root for
@return Root scope object
490074
public static IScope findRoot(IScope from) {
        IScope current = from;
        while (current.hasParent()) {
            current = current.getParent();
        }
        return current;
    }
514142
@Nonnull
  public ExpressionTreeElement getRoot() {
    if (last.isEmptySlot()) {
      return this.last;
    } else {
      ExpressionTreeElement element = last;
      while (!Thread.currentThread().isInterrupted()) {
        final ExpressionTreeElement next = element.getParent();
        if (next == null) {
          return element;
        } else {
          element = next;
        }
      }
    }
    return ExpressionTreeElement.EMPTY_SLOT;
  }
570234
public static boolean isAncestor(IBasicScope from, IBasicScope ancestor) {
        IBasicScope current = from;
        while (current.hasParent()) {
            current = current.getParent();
            if (current.equals(ancestor)) {
                return true;
            }
        }
        return false;
    }
979837
public Scope getDefiningScope() {
        Scope enclosing = getEnclosingScope();
        String name = getIdentifier();
        return enclosing == null ? null : enclosing.getDefiningScope(name);
    }
109221
public IScope getScope(String name) {
        IBasicScope child = children.getBasicScope(ScopeType.UNDEFINED, name);
        log.debug("Child of {}: {}", this.name, child);
        if (child != null) {
            if (child instanceof IScope) {
                return (IScope) child;
            }
            log.warn("Requested scope: {} is not of IScope type: {}", name, child.getClass().getName());
        }
        return null;
    }
492645
public int get_searchScope() {
        int searchScope = SearchControls.OBJECT_SCOPE;
        String scopeBuf = get_scope();
        if (scopeBuf != null) {
            if (scopeBuf.compareToIgnoreCase("base") == 0) {
                searchScope = SearchControls.OBJECT_SCOPE;
            } else if (scopeBuf.compareToIgnoreCase("one") == 0) {
                searchScope = SearchControls.ONELEVEL_SCOPE;
            } else if (scopeBuf.compareToIgnoreCase("sub") == 0) {
                searchScope = SearchControls.SUBTREE_SCOPE;
            }
        }
        return searchScope;
    }
879650
private MortarScope searchFromRoot(Scoped scoped)
  {
    // Ascend to the root.
    MortarScope root = this;
    while (root.parent != null) {
      root = root.parent;
    }

    // Do the non-recursive search.
    List<MortarScope> scopes = new LinkedList<>();
    scopes.add(root);

    while (!scopes.isEmpty()) {
      // Check first scope in the list.
      MortarScope scope = scopes.get(0);

      if (scope.tearDowns.contains(scoped)) {
        return scope;
      }

      // Replace the first scope with its children (breadth-first search).
      scopes.addAll(scope.children.values());
      scopes.remove(0);
    }

    return null;
  }
115268
def get_scope_path(cls, scope_separator="::"):
        
        if cls.get_parent_scope() is None:
            return ""
        elif isinstance(cls.get_parent_scope(), comp.Root):
            return ""
        else:
            parent_path = cls.get_parent_scope().get_scope_path(scope_separator)
            if parent_path:
                return(
                    parent_path
                    + scope_separator
                    + cls.get_parent_scope().type_name
                )
            else:
                return cls.get_parent_scope().type_name
250813
def _get_scope_with_mangled(self, name):
        """"""
        scope = self
        while True:
            parent = scope.get_enclosing_scope()
            if parent is None:
                return

            if name in parent.rev_mangled:
                return parent

            scope = parent
961873
private void popScope(boolean quietly) {
    if (!quietly && scopeCallback != null) {
      scopeCallback.exitScope(this);
    }
    Node scopeRoot;
    int roots = scopeRoots.size();
    if (roots > 0) {
      scopeRoot = scopeRoots.remove(roots - 1);
    } else {
      scopeRoot = scopes.pop().getRootNode();
    }
    if (NodeUtil.isValidCfgRoot(scopeRoot)) {
      cfgs.pop();
    }
  }
1143809
public Node getRoot(Node node)
  {

    Node root = null;

    while (node != null)
    {
      root = node;
      node = getParentOfNode(node);
    }

    return root;
  }
517633
public static TreeElement getRoot(TreeElement node)
    {
        TreeElement parentNode = node.getParent();
        while (parentNode != null) {
            node = parentNode;
            parentNode = node.getParent();
        }
        return node;
    }
863923
function () {
      let scope = context.getScope();
      while (scope) {
        const node = scope.block && scope.block.parent && scope.block.parent.parent;
        if (node && utils.isES5Component(node)) {
          return node;
        }
        scope = scope.upper;
      }
      return null;
    }
863719
public static Throwable getRootCause(Throwable t) {
        if (t == null) {
            return null;
        }
        while (t.getCause() != null) {
            t = t.getCause();
        }
        return t;
    }
819537
public static Scopes from(String... scopes)
    {
        if (scopes == null || scopes.length == 0) return NONE;
        return new Scopes(scopes, true);
    }
947541
public @Nonnull Object getRoot() {
    Chain current = this;
    while (current.hasParent()) {
      current = current.getParent();
    }
    return current.getValue();
  }
153489
public final S getClosestContainerScope() {
    S scope = getClosestHoistScope();
    if (scope.isBlockScope()) {
      scope = scope.getParent();
      checkState(!scope.isBlockScope());
    }
    return scope;
  }