third_party/es6-module-loader/loader.js
function link(linkSet) {

      var loader = linkSet.loader;

      // console.log('linking {' + logloads(loads) + '}');
      // snapshot(loader);

      // 15.2.5.3.1 LinkageGroups alternative implementation

      // build all the groups
      // because the first load represents the top of the tree
      // for a given linkset, we can work down from there
      var groups = [];
      var startingLoad = linkSet.loads[0];
      startingLoad.groupIndex = 0;
      buildLinkageGroups(startingLoad, linkSet.loads, groups, loader);

      // determine the kind of the bottom group
      var curGroupDeclarative = (startingLoad.kind == 'declarative') == groups.length % 2;

      // run through the groups from bottom to top
      for (var i = groups.length - 1; i >= 0; i--) {
        var group = groups[i];
        for (var j = 0; j < group.length; j++) {
          var load = group[j];

          // 15.2.5.5 LinkDeclarativeModules adjusted
          if (curGroupDeclarative) {
            linkDeclarativeModule(load, linkSet.loads, loader);
          }
          // 15.2.5.6 LinkDynamicModules adjusted
          else {
            var module = load.execute();
            if (!(module.__esModule))
              throw new TypeError('Execution must define a Module instance');
            load.module = {
              module: module
            };
            load.status = 'linked';
          }
          finishLoad(loader, load);
        }

        // alternative current kind for next loop
        curGroupDeclarative = !curGroupDeclarative;
      }
    }
function link(linkSet) {

      var loader = linkSet.loader;

      // console.log('linking {' + logloads(loads) + '}');
      // snapshot(loader);

      // 15.2.5.3.1 LinkageGroups alternative implementation

      // build all the groups
      // because the first load represents the top of the tree
      // for a given linkset, we can work down from there
      var groups = [];
      var startingLoad = linkSet.loads[0];
      startingLoad.groupIndex = 0;
      buildLinkageGroups(startingLoad, linkSet.loads, groups, loader);

      // determine the kind of the bottom group
      var curGroupDeclarative = (startingLoad.kind == 'declarative') == groups.length % 2;

      // run through the groups from bottom to top
      for (var i = groups.length - 1; i >= 0; i--) {
        var group = groups[i];
        for (var j = 0; j < group.length; j++) {
          var load = group[j];

          // 15.2.5.5 LinkDeclarativeModules adjusted
          if (curGroupDeclarative) {
            linkDeclarativeModule(load, linkSet.loads, loader);
          }
          // 15.2.5.6 LinkDynamicModules adjusted
          else {
            var module = load.execute();
            if (!(module.__esModule))
              throw new TypeError('Execution must define a Module instance');
            load.module = {
              module: module
            };
            load.status = 'linked';
          }
          finishLoad(loader, load);
        }

        // alternative current kind for next loop
        curGroupDeclarative = !curGroupDeclarative;
      }
    }
function link ( linkSet ) { var loader = linkSet . loader ; // console.log('linking {' + logloads(loads) + '}'); // snapshot(loader); // 15.2.5.3.1 LinkageGroups alternative implementation // build all the groups // because the first load represents the top of the tree // for a given linkset, we can work down from there var groups = [ ] ; var startingLoad = linkSet . loads [ 0 ] ; startingLoad . groupIndex = 0 ; buildLinkageGroups ( startingLoad , linkSet . loads , groups , loader ) ; // determine the kind of the bottom group var curGroupDeclarative = ( startingLoad . kind == 'declarative' ) == groups . length % 2 ; // run through the groups from bottom to top for ( var i = groups . length - 1 ; i >= 0 ; i -- ) { var group = groups [ i ] ; for ( var j = 0 ; j < group . length ; j ++ ) { var load = group [ j ] ; // 15.2.5.5 LinkDeclarativeModules adjusted if ( curGroupDeclarative ) { linkDeclarativeModule ( load , linkSet . loads , loader ) ; } // 15.2.5.6 LinkDynamicModules adjusted else { var module = load . execute ( ) ; if ( ! ( module . __esModule ) ) throw new TypeError ( 'Execution must define a Module instance' ) ; load . module = { module : module } ; load . status = 'linked' ; } finishLoad ( loader , load ) ; } // alternative current kind for next loop curGroupDeclarative = ! curGroupDeclarative ; } }
15.2.5.4
15 . 2 . 5 . 4