function find_immovable_inputs (instance, valid_scopes) {
  var immovables = {};
  var i, input;

  // Initial placement inputs cannot be pushed down.
  for (i = 0; i < instance.get_input_count(); i++) {
    input = instance.get_input(i);
    if (input.get_output_type() instanceof IRDOMPlacementType) {
      immovables[input.get_identity()] = true;
    }
  }

  if (instance instanceof PolymorphicScopeInstance) {

    // The choice computable is an essential input to the scope instance.
    var choice_input = instance.get_choice_computable();
    immovables[choice_input.get_identity()] = true;

    // We know that each scope has exactly one choice (earlier validation)
    var choice_data = instance.get_choice_data();

    for (i = 1; i < instance.get_input_count(); i++) {
      input = instance.get_input(i);

      // If computable is used in all choices, no pushdown benefit.
      var in_all_scopes = true;
      var j;
      var choice;
      for (j = 0; j < choice_data.length; ++j) {
        choice = choice_data[j];
        if (choice.inputs.indexOf(input) === -1) {
          in_all_scopes = false;
          break;
        }
      }

      // Invalid scope inputs must remain in parent_scope.
      var in_invalid_scope = false;
      for (j = 0; j < choice_data.length; ++j) {
        choice = choice_data[j];
        if (choice.inputs.indexOf(input) !== -1 && valid_scopes.indexOf(choice.scope) === -1) {
          in_invalid_scope = true;
          break;
        }
      }

      if (in_all_scopes || in_invalid_scope) {
        immovables[input.get_identity()] = input;
      }
    }
  }

  return immovables;
}
/**
 * Find all immovable inputs for scope instance. This is especially important
 * for PolymorphicScopeInstances, since scope choices won't be aware of each
 * other when deciding on pushdowns.
 *
 * @param {ScopeInstance|PolymorphicScopeInstance} instance
 * @param {Array.<Scope>} valid_scopes Instance scopes that can be pushed to
 * @returns {Object} A set of computable ids that cannot be pushed down
 */
Find all immovable inputs for scope instance. This is especially important
for PolymorphicScopeInstances, since scope choices won't be aware of each
other when deciding on pushdowns.

@param {ScopeInstance|PolymorphicScopeInstance} instance
@param {Array.} valid_scopes Instance scopes that can be pushed to
@returns {Object} A set of computable ids that cannot be pushed down
Find all immovable inputs for scope instance . This is especially important for PolymorphicScopeInstances since scope choices won ' t be aware of each other when deciding on pushdowns . @param { ScopeInstance|PolymorphicScopeInstance } instance @param { Array . } valid_scopes Instance scopes that can be pushed to @returns { Object } A set of computable ids that cannot be pushed down
function find_immovable_inputs (instance, valid_scopes) {
  var immovables = {};
  var i, input;
  for (i = 0; i < instance.get_input_count(); i++) {
    input = instance.get_input(i);
    if (input.get_output_type() instanceof IRDOMPlacementType) {
      immovables[input.get_identity()] = true;
    }
  }
  if (instance instanceof PolymorphicScopeInstance) {
    var choice_input = instance.get_choice_computable();
    immovables[choice_input.get_identity()] = true;
    var choice_data = instance.get_choice_data();
    for (i = 1; i < instance.get_input_count(); i++) {
      input = instance.get_input(i);
      var in_all_scopes = true;
      var j;
      var choice;
      for (j = 0; j < choice_data.length; ++j) {
        choice = choice_data[j];
        if (choice.inputs.indexOf(input) === -1) {
          in_all_scopes = false;
          break;
        }
      }
      var in_invalid_scope = false;
      for (j = 0; j < choice_data.length; ++j) {
        choice = choice_data[j];
        if (choice.inputs.indexOf(input) !== -1 && valid_scopes.indexOf(choice.scope) === -1) {
          in_invalid_scope = true;
          break;
        }
      }
      if (in_all_scopes || in_invalid_scope) {
        immovables[input.get_identity()] = input;
      }
    }
  }
  return immovables;
}
function find_immovable_inputs ( instance , valid_scopes ) { var immovables = { } ; var i , input ; for ( i = 0 ; i < instance . get_input_count ( ) ; i ++ ) { input = instance . get_input ( i ) ; if ( input . get_output_type ( ) instanceof IRDOMPlacementType ) { immovables [ input . get_identity ( ) ] = true ; } } if ( instance instanceof PolymorphicScopeInstance ) { var choice_input = instance . get_choice_computable ( ) ; immovables [ choice_input . get_identity ( ) ] = true ; var choice_data = instance . get_choice_data ( ) ; for ( i = 1 ; i < instance . get_input_count ( ) ; i ++ ) { input = instance . get_input ( i ) ; var in_all_scopes = true ; var j ; var choice ; for ( j = 0 ; j < choice_data . length ; ++ j ) { choice = choice_data [ j ] ; if ( choice . inputs . indexOf ( input ) === - 1 ) { in_all_scopes = false ; break ; } } var in_invalid_scope = false ; for ( j = 0 ; j < choice_data . length ; ++ j ) { choice = choice_data [ j ] ; if ( choice . inputs . indexOf ( input ) !== - 1 && valid_scopes . indexOf ( choice . scope ) === - 1 ) { in_invalid_scope = true ; break ; } } if ( in_all_scopes || in_invalid_scope ) { immovables [ input . get_identity ( ) ] = input ; } } } return immovables ; }
Find all immovable inputs for scope instance.
Find all immovable inputs for scope instance .
// Initial placement inputs cannot be pushed down. // The choice computable is an essential input to the scope instance. // We know that each scope has exactly one choice (earlier validation) // If computable is used in all choices, no pushdown benefit. // Invalid scope inputs must remain in parent_scope.