void rewriteProvidesAndRequires(Node externs, Node root) {
    checkState(!hasRewritingOccurred, "Cannot call rewriteProvidesAndRequires twice per instance");
    hasRewritingOccurred = true;

    collectProvidedNames(externs, root);

    for (ProvidedName pn : providedNames.values()) {
      pn.replace();
    }
    deleteNamespaceInitializationsFromPreviousProvides();

    if (requiresLevel.isOn()) {
      for (UnrecognizedRequire r : unrecognizedRequires) {
        checkForLateOrMissingProvide(r);
      }
    }

    for (Node closureRequire : requiresToBeRemoved) {
      compiler.reportChangeToEnclosingScope(closureRequire);
      closureRequire.detach();
    }
    for (Node forwardDeclare : forwardDeclaresToRemove) {
      NodeUtil.deleteNode(forwardDeclare, compiler);
    }
  }
void rewriteProvidesAndRequires ( Node externs , Node root ) { checkState ( ! hasRewritingOccurred , "Cannot call rewriteProvidesAndRequires twice per instance" ) ; hasRewritingOccurred = true ; collectProvidedNames ( externs , root ) ; for ( ProvidedName pn : providedNames . values ( ) ) { pn . replace ( ) ; } deleteNamespaceInitializationsFromPreviousProvides ( ) ; if ( requiresLevel . isOn ( ) ) { for ( UnrecognizedRequire r : unrecognizedRequires ) { checkForLateOrMissingProvide ( r ) ; } } for ( Node closureRequire : requiresToBeRemoved ) { compiler . reportChangeToEnclosingScope ( closureRequire ) ; closureRequire . detach ( ) ; } for ( Node forwardDeclare : forwardDeclaresToRemove ) { NodeUtil . deleteNode ( forwardDeclare , compiler ) ; } }
Rewrites all provides and requires in the given namespace.

<p>Call this instead of {@link #collectProvidedNames(Node, Node)} if you want rewriting.