code: private static StaticScope getLookupScope(StaticScope scope, String name) {
      if (scope != null && scope.getParentScope() != null) {
        StaticSlot slot = scope.getSlot(getRootElementOfName(name));
        return slot != null ? slot.getScope() : null;
      }
      return scope;
    }
docs: @return Which scope in the provided scope chain the provided name is declared in, or else null.
  
  This assumed that the Scope construction is
  complete.  It can not be used during scope construction to determine if a name is already
  defined as a shadowed name from a parent scope would be returned.