code: void patchGlobalTypedScope(AbstractCompiler compiler, Node scriptRoot) {
      checkNotNull(typedScopeCreator);
      typedScopeCreator.patchGlobalScope(topScope, scriptRoot);
    }
docs: Regenerates the top scope potentially only for a sub-tree of AST and then
  copies information for the old global scope.
  
  @param compiler The compiler for which the global scope is generated.
  @param scriptRoot The root of the AST used to generate global scope.