@Override
  public boolean hasGlobals() {
    if (myGlobals == null || myNestedScopes == null) {
      collectDeclarations();
    }
    if (!myGlobals.isEmpty()) return true;
    return myNestedScopes.stream().anyMatch(scope -> scope.hasGlobals());
  }
@Override
  public boolean hasGlobals()