function compose(containerBlock) {
    var itemBlock = containerBlock.getInputTargetBlock('STACK'); // Count number of inputs.

    var connections = [];

    while (itemBlock) {
      connections.push(itemBlock.valueConnection_);
      itemBlock = itemBlock.nextConnection && itemBlock.nextConnection.targetBlock();
    } // Disconnect any children that don't belong.


    for (var i = 0; i < this.itemCount_; i++) {
      var connection = this.getInput('ADD' + i).connection.targetConnection;

      if (connection && connections.indexOf(connection) == -1) {
        connection.disconnect();
      }
    }

    this.itemCount_ = connections.length;
    this.updateShape_(); // Reconnect any child blocks.

    for (var i = 0; i < this.itemCount_; i++) {
      Blockly.Mutator.reconnect(connections[i], this, 'ADD' + i);
    }
  }
/**
   * Reconfigure this block based on the mutator dialog's components.
   * @param {!Blockly.Block} containerBlock Root block in mutator.
   * @this Blockly.Block
   */
Reconfigure this block based on the mutator dialog's components.
@param {!Blockly.Block} containerBlock Root block in mutator.
Reconfigure this block based on the mutator dialog ' s components . @param { !Blockly . Block } containerBlock Root block in mutator .
function compose(containerBlock) {
    var itemBlock = containerBlock.getInputTargetBlock('STACK'); 
    var connections = [];
    while (itemBlock) {
      connections.push(itemBlock.valueConnection_);
      itemBlock = itemBlock.nextConnection && itemBlock.nextConnection.targetBlock();
    } 
    for (var i = 0; i < this.itemCount_; i++) {
      var connection = this.getInput('ADD' + i).connection.targetConnection;
      if (connection && connections.indexOf(connection) == -1) {
        connection.disconnect();
      }
    }
    this.itemCount_ = connections.length;
    this.updateShape_(); 
    for (var i = 0; i < this.itemCount_; i++) {
      Blockly.Mutator.reconnect(connections[i], this, 'ADD' + i);
    }
  }
function compose ( containerBlock ) { var itemBlock = containerBlock . getInputTargetBlock ( 'STACK' ) ; var connections = [ ] ; while ( itemBlock ) { connections . push ( itemBlock . valueConnection_ ) ; itemBlock = itemBlock . nextConnection && itemBlock . nextConnection . targetBlock ( ) ; } for ( var i = 0 ; i < this . itemCount_ ; i ++ ) { var connection = this . getInput ( 'ADD' + i ) . connection . targetConnection ; if ( connection && connections . indexOf ( connection ) == - 1 ) { connection . disconnect ( ) ; } } this . itemCount_ = connections . length ; this . updateShape_ ( ) ; for ( var i = 0 ; i < this . itemCount_ ; i ++ ) { Blockly . Mutator . reconnect ( connections [ i ] , this , 'ADD' + i ) ; } }
Reconfigure this block based on the mutator dialog's components.
Reconfigure this block based on the mutator dialog ' s components .
// Count number of inputs. // Disconnect any children that don't belong. // Reconnect any child blocks.