function remove_and_replace (computable) {
  var scope = computable.get_containing_scope();
  var instance = computable.get_input(0);
  var placement = computable.get_input(1);

  // Replace instance's VirtualPlacement(s) with real placement.
  var virtual_placement = null;

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

    if (input instanceof VirtualPlacement) {
      virtual_placement = input;
      instance.set_input(i, placement);
    }
  }

  /**
   * If no virtual placement exists, the 'instance' is actually a passthrough
   * for the 'output' field_name of a model scope. In these situations, the
   * InsertInitializedElement can be replaced with a more specific computable.
   */
  if (!virtual_placement) {
    new DOMUnescapedVariable(scope, instance, placement);
  } else {
    virtual_placement.destroy();
  }

  // If InsertInitializedElement has any dependees, re-route 'after' output
  if (computable.get_dependee_count() || scope.is_output(computable)) {
    var nested_passthrough = instance.get_property('after');

    while (computable.get_dependee_count()) {
      var dependee = computable.get_dependee(0);
      var input_indices = dependee.get_input_indices(computable);
      for (var j = 0; j < input_indices.length; j++) {
        dependee.set_input(input_indices[j], nested_passthrough);
      }
    }

    if (scope.is_output(computable)) {
      scope.replace_output(nested_passthrough, 'after');
    }
  }

  computable.destroy();
  return;
}
/**
 * Remove computable and rewire its inputs directly to its outputs.
 * @param {InsertInitializedElement} computable
 */
Remove computable and rewire its inputs directly to its outputs.
Remove computable and rewire its inputs directly to its outputs .
function remove_and_replace (computable) {
  var scope = computable.get_containing_scope();
  var instance = computable.get_input(0);
  var placement = computable.get_input(1);
  var virtual_placement = null;
  for (var i = 0; i < instance.get_input_count(); i++) {
    var input = instance.get_input(i);
    if (input instanceof VirtualPlacement) {
      virtual_placement = input;
      instance.set_input(i, placement);
    }
  }
  if (!virtual_placement) {
    new DOMUnescapedVariable(scope, instance, placement);
  } else {
    virtual_placement.destroy();
  }
  if (computable.get_dependee_count() || scope.is_output(computable)) {
    var nested_passthrough = instance.get_property('after');
    while (computable.get_dependee_count()) {
      var dependee = computable.get_dependee(0);
      var input_indices = dependee.get_input_indices(computable);
      for (var j = 0; j < input_indices.length; j++) {
        dependee.set_input(input_indices[j], nested_passthrough);
      }
    }
    if (scope.is_output(computable)) {
      scope.replace_output(nested_passthrough, 'after');
    }
  }
  computable.destroy();
  return;
}
function remove_and_replace ( computable ) { var scope = computable . get_containing_scope ( ) ; var instance = computable . get_input ( 0 ) ; var placement = computable . get_input ( 1 ) ; var virtual_placement = null ; for ( var i = 0 ; i < instance . get_input_count ( ) ; i ++ ) { var input = instance . get_input ( i ) ; if ( input instanceof VirtualPlacement ) { virtual_placement = input ; instance . set_input ( i , placement ) ; } } if ( ! virtual_placement ) { new DOMUnescapedVariable ( scope , instance , placement ) ; } else { virtual_placement . destroy ( ) ; } if ( computable . get_dependee_count ( ) || scope . is_output ( computable ) ) { var nested_passthrough = instance . get_property ( 'after' ) ; while ( computable . get_dependee_count ( ) ) { var dependee = computable . get_dependee ( 0 ) ; var input_indices = dependee . get_input_indices ( computable ) ; for ( var j = 0 ; j < input_indices . length ; j ++ ) { dependee . set_input ( input_indices [ j ] , nested_passthrough ) ; } } if ( scope . is_output ( computable ) ) { scope . replace_output ( nested_passthrough , 'after' ) ; } } computable . destroy ( ) ; return ; }
Remove computable and rewire its inputs directly to its outputs.
Remove computable and rewire its inputs directly to its outputs .
// Replace instance's VirtualPlacement(s) with real placement. /**
   * If no virtual placement exists, the 'instance' is actually a passthrough
   * for the 'output' field_name of a model scope. In these situations, the
   * InsertInitializedElement can be replaced with a more specific computable.
   */ // If InsertInitializedElement has any dependees, re-route 'after' output