code: public <T extends SourceFile> void initModules(
        List<T> externs, List<JSModule> modules, CompilerOptions options) {
      initOptions(options);
  
      checkFirstModule(modules);
  
      this.externs = makeExternInputs(externs);
  
      // Generate the module graph, and report any errors in the module specification as errors.
      try {
        this.moduleGraph = new JSModuleGraph(modules);
      } catch (JSModuleGraph.ModuleDependenceException e) {
        // problems with the module format.  Report as an error.  The
        // message gives all details.
        report(JSError.make(MODULE_DEPENDENCY_ERROR,
            e.getModule().getName(), e.getDependentModule().getName()));
        return;
      }
  
      // Creating the module graph can move weak source around, and end up with empty modules.
      fillEmptyModules(getModules());
  
      this.commentsPerFile = new ConcurrentHashMap<>(moduleGraph.getInputCount());
      initBasedOnOptions();
  
      initInputsByIdMap();
  
      initAST();
    }
docs: Initializes the instance state needed for a compile job if the sources
  are in modules.