code: function(e) {
      var legal = false;
      // Is the block nested in a loop?
      var block = this;
      do {
        if (this.LOOP_TYPES.indexOf(block.type) != -1) {
          legal = true;
          break;
        }
        block = block.getSurroundParent();
      } while (block);
      if (legal) {
        this.setWarningText(null);
      } else {
        this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_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