docs: public void replaceWith(Scope newScope) {
          if (childScopes != null) {
              for (Scope kid : childScopes) {
                  newScope.addChildScope(kid);  // sets kid's parent
              }
              childScopes.clear();
              childScopes = null;
          }
          if (symbolTable != null && !symbolTable.isEmpty()) {
              joinScopes(this, newScope);
          }
      }