function createProcDefBlock(
  workspace,
  hasReturn = false,
  nameId = 'proc name',
  hasStatements = true,
) {
  const type = hasReturn ? 'procedures_defreturn' : 'procedures_defnoreturn';
  return Blockly.Xml.domToBlock(
    Blockly.utils.xml.textToDom(
      '<block type="' +
        type +
        '">' +
        (hasStatements
          ? ''
          : '    <mutation statements="false"></mutation>\n') +
        '  <field name="NAME">' +
        nameId +
        '</field>' +
        '</block>',
    ),
    workspace,
  );
}
Creates procedure definition block using domToBlock call.
@param {!Blockly.Workspace} workspace The Blockly workspace.
@param {boolean=} hasReturn Whether the procedure definition should have
   return.
@param {string=} nameId The procedure name.
@param {boolean=} hasStatements Whether the block has statements (STACK).
@returns {Blockly.Block} The created block.