function process_ir(scope_data) {
  var name, scope;

  // This loop is only needed if root_elements are not marked as shard_roots.
  for (name in scope_data.root_element_scopes) {
    scope = scope_data.root_element_scopes[name];
    if (!scope.is_shard_root()) {
      gather_dependencies(scope);
    }
  }
  for (name in scope_data.element_scopes) {
    scope = scope_data.element_scopes[name];
    if (scope.is_shard_root()) {
      gather_dependencies(scope);
    }
  }

  var pushed_deps = 0;
  for (name in scope_data.element_scopes) {
    scope = scope_data.element_scopes[name];
    if (!scope.is_shard_root() && !scope_data.root_element_scopes[name]) {
      var deps = get_scope_dependencies(scope_data.element_scopes[name]);
      for (var i = 0; i < deps.length; i++) {
        deps[i].destroy();
        pushed_deps++;
      }
    }
  }

  if (pushed_deps) {
    var pluralized = pushed_deps > 1 ? 'dependencies.' : 'dependency.';
    console.log('Moved', pushed_deps, 'scope', pluralized);
  }

  return scope_data;
}
/**
 * Move all scope dependencies upwards to their shard_root
 */
Move all scope dependencies upwards to their shard_root
Move all scope dependencies upwards to their shard_root
function process_ir(scope_data) {
  var name, scope;
  for (name in scope_data.root_element_scopes) {
    scope = scope_data.root_element_scopes[name];
    if (!scope.is_shard_root()) {
      gather_dependencies(scope);
    }
  }
  for (name in scope_data.element_scopes) {
    scope = scope_data.element_scopes[name];
    if (scope.is_shard_root()) {
      gather_dependencies(scope);
    }
  }
  var pushed_deps = 0;
  for (name in scope_data.element_scopes) {
    scope = scope_data.element_scopes[name];
    if (!scope.is_shard_root() && !scope_data.root_element_scopes[name]) {
      var deps = get_scope_dependencies(scope_data.element_scopes[name]);
      for (var i = 0; i < deps.length; i++) {
        deps[i].destroy();
        pushed_deps++;
      }
    }
  }
  if (pushed_deps) {
    var pluralized = pushed_deps > 1 ? 'dependencies.' : 'dependency.';
    console.log('Moved', pushed_deps, 'scope', pluralized);
  }
  return scope_data;
}
function process_ir ( scope_data ) { var name , scope ; for ( name in scope_data . root_element_scopes ) { scope = scope_data . root_element_scopes [ name ] ; if ( ! scope . is_shard_root ( ) ) { gather_dependencies ( scope ) ; } } for ( name in scope_data . element_scopes ) { scope = scope_data . element_scopes [ name ] ; if ( scope . is_shard_root ( ) ) { gather_dependencies ( scope ) ; } } var pushed_deps = 0 ; for ( name in scope_data . element_scopes ) { scope = scope_data . element_scopes [ name ] ; if ( ! scope . is_shard_root ( ) && ! scope_data . root_element_scopes [ name ] ) { var deps = get_scope_dependencies ( scope_data . element_scopes [ name ] ) ; for ( var i = 0 ; i < deps . length ; i ++ ) { deps [ i ] . destroy ( ) ; pushed_deps ++ ; } } } if ( pushed_deps ) { var pluralized = pushed_deps > 1 ? 'dependencies.' : 'dependency.' ; console . log ( 'Moved' , pushed_deps , 'scope' , pluralized ) ; } return scope_data ; }
Move all scope dependencies upwards to their shard_root
Move all scope dependencies upwards to their shard_root
// This loop is only needed if root_elements are not marked as shard_roots.