code: function(e) {
      var legal = false;
      // Is the block nested in a procedure?
      var block = this;
      do {
        if (this.FUNCTION_TYPES.indexOf(block.type) != -1) {
          legal = true;
          break;
        }
        block = block.getSurroundParent();
      } while (block);
      if (legal) {
        // If needed, toggle whether this block has a return value.
        if (block.type == 'procedures_defnoreturn' && this.hasReturnValue_) {
          this.removeInput('VALUE');
          this.appendDummyInput('VALUE')
            .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
          this.hasReturnValue_ = false;
        } else if (block.type == 'procedures_defreturn' &&
                   !this.hasReturnValue_) {
          this.removeInput('VALUE');
          this.appendValueInput('VALUE')
            .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
          this.hasReturnValue_ = true;
        }
        this.setWarningText(null);
      } else {
        this.setWarningText(Blockly.Msg.PROCEDURES_IFRETURN_WARNING);
      }
    }
docs: Called whenever anything on the workspace changes.
  Add warning if this flow block is not nested inside a loop.
  @param {!Blockly.Events.Abstract} e Change event.
  @this Blockly.Block