From 9a182d511c108de83a60c7f622a0c053afc9aecf Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Tue, 30 Nov 2021 23:08:04 +0000 Subject: [PATCH 1/4] refactor: Turn .getSurroundLoop into a (Block) method This considerably simplifies the code in the genrators, obviating the need for generators to import Blockly.Constants.Loops, and allowing the compiler to remove blocks/loops.js from the first (Blockly) chunk of the compilation. (The latter could and should have been arranged by making the generator chunks depend on the blocks chunk, but that is no longer necessary.) --- blocks/loops.js | 11 ++-- generators/dart/loops.js | 3 +- generators/javascript/loops.js | 4 +- generators/lua/loops.js | 3 +- generators/php/loops.js | 3 +- generators/python/loops.js | 3 +- scripts/gulpfiles/chunks.json | 106 ++++++++++++++++----------------- tests/deps.js | 2 +- 8 files changed, 64 insertions(+), 71 deletions(-) diff --git a/blocks/loops.js b/blocks/loops.js index 9781e857142..10ab203e4c9 100644 --- a/blocks/loops.js +++ b/blocks/loops.js @@ -297,12 +297,12 @@ Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = { ], /** - * Is the given block enclosed (at any level) by a loop? - * @param {!Blockly.Block} block Current block. + * Is this block enclosed (at any level) by a loop? * @return {Blockly.Block} The nearest surrounding loop, or null if none. + * @this {Blockly.Block} */ - getSurroundLoop: function(block) { - // Is the block nested in a loop? + getSurroundLoop: function() { + let block = this; do { if (Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.LOOP_TYPES .indexOf(block.type) !== -1) { @@ -327,8 +327,7 @@ Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = { e.type !== Blockly.Events.BLOCK_MOVE) { return; } - const enabled = Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN - .getSurroundLoop(this); + const enabled = this.getSurroundLoop(this); this.setWarningText(enabled ? null : Blockly.Msg['CONTROLS_FLOW_STATEMENTS_WARNING']); if (!this.isInFlyout) { diff --git a/generators/dart/loops.js b/generators/dart/loops.js index ca202288ff6..63a7762bb16 100644 --- a/generators/dart/loops.js +++ b/generators/dart/loops.js @@ -152,8 +152,7 @@ Blockly.Dart['controls_flow_statements'] = function(block) { xfix += Blockly.Dart.injectId(Blockly.Dart.STATEMENT_SUFFIX, block); } if (Blockly.Dart.STATEMENT_PREFIX) { - const loop = Blockly.Constants.Loops - .CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(block); + const loop = block.getSurroundLoop(); if (loop && !loop.suppressPrefixSuffix) { // Inject loop's statement prefix here since the regular one at the end // of the loop will not get executed if 'continue' is triggered. diff --git a/generators/javascript/loops.js b/generators/javascript/loops.js index bd80d384a46..ffb9d094c19 100644 --- a/generators/javascript/loops.js +++ b/generators/javascript/loops.js @@ -12,7 +12,6 @@ goog.provide('Blockly.JavaScript.loops'); -goog.require('Blockly.Constants.Loops'); goog.require('Blockly.JavaScript'); goog.require('Blockly.utils.string'); @@ -167,8 +166,7 @@ Blockly.JavaScript['controls_flow_statements'] = function(block) { block); } if (Blockly.JavaScript.STATEMENT_PREFIX) { - const loop = Blockly.Constants.Loops - .CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(block); + const loop = block.getSurroundLoop(); if (loop && !loop.suppressPrefixSuffix) { // Inject loop's statement prefix here since the regular one at the end // of the loop will not get executed if 'continue' is triggered. diff --git a/generators/lua/loops.js b/generators/lua/loops.js index 6e2cd4bbd04..017f7d5a870 100644 --- a/generators/lua/loops.js +++ b/generators/lua/loops.js @@ -156,8 +156,7 @@ Blockly.Lua['controls_flow_statements'] = function(block) { xfix += Blockly.Lua.injectId(Blockly.Lua.STATEMENT_SUFFIX, block); } if (Blockly.Lua.STATEMENT_PREFIX) { - const loop = Blockly.Constants.Loops - .CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(block); + const loop = block.getSurroundLoop(); if (loop && !loop.suppressPrefixSuffix) { // Inject loop's statement prefix here since the regular one at the end // of the loop will not get executed if 'continue' is triggered. diff --git a/generators/php/loops.js b/generators/php/loops.js index 9e59378be97..b30c9316299 100644 --- a/generators/php/loops.js +++ b/generators/php/loops.js @@ -153,8 +153,7 @@ Blockly.PHP['controls_flow_statements'] = function(block) { xfix += Blockly.PHP.injectId(Blockly.PHP.STATEMENT_SUFFIX, block); } if (Blockly.PHP.STATEMENT_PREFIX) { - const loop = Blockly.Constants.Loops - .CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(block); + const loop = block.getSurroundLoop(); if (loop && !loop.suppressPrefixSuffix) { // Inject loop's statement prefix here since the regular one at the end // of the loop will not get executed if 'continue' is triggered. diff --git a/generators/python/loops.js b/generators/python/loops.js index 9150076917a..85c64b6b93c 100644 --- a/generators/python/loops.js +++ b/generators/python/loops.js @@ -197,8 +197,7 @@ Blockly.Python['controls_flow_statements'] = function(block) { xfix += Blockly.Python.injectId(Blockly.Python.STATEMENT_SUFFIX, block); } if (Blockly.Python.STATEMENT_PREFIX) { - const loop = Blockly.Constants.Loops - .CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(block); + const loop = block.getSurroundLoop(); if (loop && !loop.suppressPrefixSuffix) { // Inject loop's statement prefix here since the regular one at the end // of the loop will not get executed if 'continue' is triggered. diff --git a/scripts/gulpfiles/chunks.json b/scripts/gulpfiles/chunks.json index 3a798cb9738..ce48d228093 100644 --- a/scripts/gulpfiles/chunks.json +++ b/scripts/gulpfiles/chunks.json @@ -1,7 +1,7 @@ { "chunk": [ - "requires:259", - "all:9:requires", + "requires:258", + "all:10:requires", "all1:11:requires", "all2:11:requires", "all3:11:requires", @@ -11,63 +11,63 @@ "js": [ "./core/serialization/workspaces.js", "./core/serialization/variables.js", - "./core/inject.js", - "./core/flyout_vertical.js", - "./core/toolbox/toolbox.js", - "./core/interfaces/i_styleable.js", - "./core/flyout_horizontal.js", - "./core/flyout_base.js", - "./core/flyout_metrics_manager.js", - "./core/field_variable.js", - "./core/field_number.js", - "./core/field_multilineinput.js", - "./core/field_label_serializable.js", - "./core/field_colour.js", - "./core/field_checkbox.js", - "./core/field_angle.js", - "./core/toolbox/collapsible_category.js", - "./core/renderers/zelos/measurables/top_row.js", - "./core/renderers/zelos/measurables/inputs.js", - "./core/renderers/zelos/measurables/row_elements.js", - "./core/renderers/zelos/marker_svg.js", - "./core/renderers/zelos/renderer.js", - "./core/field_textinput.js", - "./core/field_image.js", - "./core/renderers/zelos/info.js", - "./core/renderers/zelos/path_object.js", - "./core/renderers/zelos/drawer.js", - "./core/renderers/zelos/constants.js", - "./core/renderers/zelos/measurables/bottom_row.js", - "./core/renderers/zelos/zelos.js", - "./core/renderers/thrasos/renderer.js", - "./core/renderers/thrasos/info.js", - "./core/renderers/thrasos/thrasos.js", - "./core/renderers/minimalist/renderer.js", - "./core/renderers/minimalist/info.js", - "./core/renderers/minimalist/drawer.js", - "./core/renderers/minimalist/constants.js", - "./core/renderers/minimalist/minimalist.js", - "./core/renderers/geras/measurables/statement_input.js", + "./core/widgetdiv.js", + "./core/clipboard.js", + "./core/menuitem.js", + "./core/menu.js", + "./core/contextmenu.js", + "./core/contextmenu_items.js", + "./core/shortcut_items.js", + "./core/theme/zelos.js", + "./core/theme/themes.js", + "./core/renderers/geras/constants.js", + "./core/renderers/geras/highlight_constants.js", + "./core/renderers/geras/measurables/inline_input.js", "./core/renderers/geras/path_object.js", "./core/renderers/geras/renderer.js", - "./core/renderers/geras/measurables/inline_input.js", + "./core/renderers/geras/measurables/statement_input.js", "./core/renderers/geras/info.js", - "./core/renderers/geras/highlight_constants.js", "./core/renderers/geras/highlighter.js", "./core/renderers/geras/drawer.js", - "./core/renderers/geras/constants.js", "./core/renderers/geras/geras.js", - "./core/theme/zelos.js", - "./core/theme/themes.js", - "./core/shortcut_items.js", - "./core/contextmenu_items.js", - "./core/menu.js", - "./core/menuitem.js", - "./core/clipboard.js", - "./core/widgetdiv.js", - "./core/contextmenu.js", - "./core/blockly.js", + "./core/renderers/minimalist/constants.js", + "./core/renderers/minimalist/renderer.js", + "./core/renderers/minimalist/info.js", + "./core/renderers/minimalist/drawer.js", + "./core/renderers/minimalist/minimalist.js", + "./core/renderers/thrasos/renderer.js", + "./core/renderers/thrasos/info.js", + "./core/renderers/thrasos/thrasos.js", + "./core/renderers/zelos/measurables/bottom_row.js", + "./core/renderers/zelos/constants.js", + "./core/renderers/zelos/path_object.js", + "./core/field_image.js", + "./core/field_textinput.js", + "./core/renderers/zelos/marker_svg.js", + "./core/renderers/zelos/renderer.js", + "./core/renderers/zelos/measurables/row_elements.js", + "./core/renderers/zelos/measurables/inputs.js", + "./core/renderers/zelos/measurables/top_row.js", + "./core/renderers/zelos/info.js", + "./core/renderers/zelos/drawer.js", + "./core/renderers/zelos/zelos.js", + "./core/toolbox/collapsible_category.js", + "./core/field_angle.js", + "./core/field_checkbox.js", + "./core/field_colour.js", + "./core/field_label_serializable.js", + "./core/field_multilineinput.js", + "./core/field_number.js", + "./core/field_variable.js", + "./core/flyout_metrics_manager.js", + "./core/flyout_base.js", "./core/generator.js", + "./core/flyout_horizontal.js", + "./core/interfaces/i_styleable.js", + "./core/toolbox/toolbox.js", + "./core/flyout_vertical.js", + "./core/inject.js", + "./core/blockly.js", "./core/field_dropdown.js", "./core/events/workspace_events.js", "./core/events/events_toolbox_item_select.js", @@ -266,13 +266,13 @@ "./core/utils/global.js", "./core/msg.js", "./closure/goog/base_minimal.js", - "./blocks/loops.js", "./core/requires.js", "./blocks/variables_dynamic.js", "./blocks/variables.js", "./blocks/text.js", "./blocks/procedures.js", "./blocks/math.js", + "./blocks/loops.js", "./blocks/logic.js", "./blocks/lists.js", "./blocks/colour.js", diff --git a/tests/deps.js b/tests/deps.js index 5fa5ccd46f8..4c74b638959 100644 --- a/tests/deps.js +++ b/tests/deps.js @@ -281,7 +281,7 @@ goog.addDependency('../../generators/javascript/all.js', ['Blockly.JavaScript.al goog.addDependency('../../generators/javascript/colour.js', ['Blockly.JavaScript.colour'], ['Blockly.JavaScript'], {'lang': 'es6'}); goog.addDependency('../../generators/javascript/lists.js', ['Blockly.JavaScript.lists'], ['Blockly.JavaScript'], {'lang': 'es6'}); goog.addDependency('../../generators/javascript/logic.js', ['Blockly.JavaScript.logic'], ['Blockly.JavaScript'], {'lang': 'es6'}); -goog.addDependency('../../generators/javascript/loops.js', ['Blockly.JavaScript.loops'], ['Blockly.Constants.Loops', 'Blockly.JavaScript', 'Blockly.utils.string'], {'lang': 'es6'}); +goog.addDependency('../../generators/javascript/loops.js', ['Blockly.JavaScript.loops'], ['Blockly.JavaScript', 'Blockly.utils.string'], {'lang': 'es6'}); goog.addDependency('../../generators/javascript/math.js', ['Blockly.JavaScript.math'], ['Blockly.JavaScript'], {'lang': 'es6'}); goog.addDependency('../../generators/javascript/procedures.js', ['Blockly.JavaScript.procedures'], ['Blockly.JavaScript'], {'lang': 'es6'}); goog.addDependency('../../generators/javascript/text.js', ['Blockly.JavaScript.texts'], ['Blockly.JavaScript'], {'lang': 'es6'}); From fa6e69a1579bd259a5e8bdb4586343d8f93bf216 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Tue, 30 Nov 2021 23:11:54 +0000 Subject: [PATCH 2/4] refactor: Migrate blocks/loops.js to goog.module --- blocks/loops.js | 68 ++++++++++++++++++++++++------------------------- tests/deps.js | 2 +- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/blocks/loops.js b/blocks/loops.js index 10ab203e4c9..0524847a4f2 100644 --- a/blocks/loops.js +++ b/blocks/loops.js @@ -10,8 +10,7 @@ */ 'use strict'; -goog.provide('Blockly.blocks.loops'); -goog.provide('Blockly.Constants.Loops'); +goog.module('Blockly.blocks.loops'); goog.require('Blockly'); goog.require('Blockly.FieldDropdown'); @@ -21,13 +20,7 @@ goog.require('Blockly.FieldVariable'); goog.require('Blockly.Warning'); -/** - * Unused constant for the common HSV hue for all blocks in this category. - * @deprecated Use Blockly.Msg['LOOPS_HUE']. (2018 April 5) - */ -Blockly.Constants.Loops.HUE = 120; - -Blockly.defineBlocksWithJsonArray([ +Blockly.common.defineBlocksWithJsonArray([ // Block for repeat n times (external number). { "type": "controls_repeat_ext", @@ -201,32 +194,30 @@ Blockly.defineBlocksWithJsonArray([ /** * Tooltips for the 'controls_whileUntil' block, keyed by MODE value. * @see {Blockly.Extensions#buildTooltipForDropdown} - * @package * @readonly */ -Blockly.Constants.Loops.WHILE_UNTIL_TOOLTIPS = { +const WHILE_UNTIL_TOOLTIPS = { 'WHILE': '%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}', 'UNTIL': '%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}', }; Blockly.Extensions.register('controls_whileUntil_tooltip', Blockly.Extensions.buildTooltipForDropdown( - 'MODE', Blockly.Constants.Loops.WHILE_UNTIL_TOOLTIPS)); + 'MODE', WHILE_UNTIL_TOOLTIPS)); /** * Tooltips for the 'controls_flow_statements' block, keyed by FLOW value. * @see {Blockly.Extensions#buildTooltipForDropdown} - * @package * @readonly */ -Blockly.Constants.Loops.BREAK_CONTINUE_TOOLTIPS = { +const BREAK_CONTINUE_TOOLTIPS = { 'BREAK': '%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}', 'CONTINUE': '%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}', }; Blockly.Extensions.register('controls_flow_tooltip', Blockly.Extensions.buildTooltipForDropdown( - 'FLOW', Blockly.Constants.Loops.BREAK_CONTINUE_TOOLTIPS)); + 'FLOW', BREAK_CONTINUE_TOOLTIPS)); /** * Mixin to add a context menu item to create a 'variables_get' block. @@ -236,7 +227,7 @@ Blockly.Extensions.register('controls_flow_tooltip', * @package * @readonly */ -Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = { +const CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = { /** * Add context menu option to create getter block for the loop's variable. * (customContextMenu support limited to web BlockSvg.) @@ -264,7 +255,7 @@ Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = { }; Blockly.Extensions.registerMixin('contextMenu_newGetVariableBlock', - Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN); + CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN); Blockly.Extensions.register('controls_for_tooltip', Blockly.Extensions.buildTooltipWithFieldText( @@ -274,6 +265,29 @@ Blockly.Extensions.register('controls_forEach_tooltip', Blockly.Extensions.buildTooltipWithFieldText( '%{BKY_CONTROLS_FOREACH_TOOLTIP}', 'VAR')); +/** + * List of block types that are loops and thus do not need warnings. + * To add a new loop type add this to your code: + * + * // If using the Blockly npm package and es6 import syntax: + * import {loopTypes} from 'blockly/blocks'; + * loopTypes.push('custom_loop'); + * + * // Else if using Closure Compiler and goog.modules: + * const {loopTypes} = goog.require('Blockly.blocks.loops'); + * loopTypes.push('custom_loop'); + * + * @type {!Array} + */ +const loopTypes = [ + 'controls_repeat', + 'controls_repeat_ext', + 'controls_forEach', + 'controls_for', + 'controls_whileUntil', +]; +exports.loopTypes = loopTypes; + /** * This mixin adds a check to make sure the 'controls_flow_statements' block * is contained in a loop. Otherwise a warning is added to the block. @@ -282,20 +296,7 @@ Blockly.Extensions.register('controls_forEach_tooltip', * @public * @readonly */ -Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = { - /** - * List of block types that are loops and thus do not need warnings. - * To add a new loop type add this to your code: - * Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.LOOP_TYPES.push('custom_loop'); - */ - LOOP_TYPES: [ - 'controls_repeat', - 'controls_repeat_ext', - 'controls_forEach', - 'controls_for', - 'controls_whileUntil', - ], - +const CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = { /** * Is this block enclosed (at any level) by a loop? * @return {Blockly.Block} The nearest surrounding loop, or null if none. @@ -304,8 +305,7 @@ Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = { getSurroundLoop: function() { let block = this; do { - if (Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.LOOP_TYPES - .indexOf(block.type) !== -1) { + if (loopTypes.includes(block.type)) { return block; } block = block.getSurroundParent(); @@ -341,4 +341,4 @@ Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = { }; Blockly.Extensions.registerMixin('controls_flow_in_loop_check', - Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN); + CONTROL_FLOW_IN_LOOP_CHECK_MIXIN); diff --git a/tests/deps.js b/tests/deps.js index 4c74b638959..a4a43defef1 100644 --- a/tests/deps.js +++ b/tests/deps.js @@ -2,7 +2,7 @@ goog.addDependency('../../blocks/all.js', ['Blockly.blocks.all'], ['Blockly.bloc goog.addDependency('../../blocks/colour.js', ['Blockly.blocks.colour'], ['Blockly.common'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../blocks/lists.js', ['Blockly.blocks.lists'], ['Blockly.ConnectionType', 'Blockly.FieldDropdown', 'Blockly.Input', 'Blockly.Msg', 'Blockly.Mutator', 'Blockly.blocks', 'Blockly.common', 'Blockly.utils.xml'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../blocks/logic.js', ['Blockly.blocks.logic'], ['Blockly.Events', 'Blockly.Extensions', 'Blockly.FieldDropdown', 'Blockly.FieldLabel', 'Blockly.Msg', 'Blockly.Mutator', 'Blockly.common', 'Blockly.utils.xml'], {'lang': 'es6', 'module': 'goog'}); -goog.addDependency('../../blocks/loops.js', ['Blockly.Constants.Loops', 'Blockly.blocks.loops'], ['Blockly', 'Blockly.FieldDropdown', 'Blockly.FieldLabel', 'Blockly.FieldNumber', 'Blockly.FieldVariable', 'Blockly.Warning'], {'lang': 'es6'}); +goog.addDependency('../../blocks/loops.js', ['Blockly.blocks.loops'], ['Blockly', 'Blockly.FieldDropdown', 'Blockly.FieldLabel', 'Blockly.FieldNumber', 'Blockly.FieldVariable', 'Blockly.Warning'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../blocks/math.js', ['Blockly.Constants.Math', 'Blockly.blocks.math'], ['Blockly', 'Blockly.FieldDropdown', 'Blockly.FieldLabel', 'Blockly.FieldNumber', 'Blockly.FieldVariable'], {'lang': 'es6'}); goog.addDependency('../../blocks/procedures.js', ['Blockly.blocks.procedures'], ['Blockly.Comment', 'Blockly.ContextMenu', 'Blockly.Events', 'Blockly.FieldCheckbox', 'Blockly.FieldLabel', 'Blockly.FieldTextInput', 'Blockly.Input', 'Blockly.Msg', 'Blockly.Mutator', 'Blockly.Names', 'Blockly.Procedures', 'Blockly.Variables', 'Blockly.Warning', 'Blockly.Xml', 'Blockly.blocks', 'Blockly.internalConstants', 'Blockly.utils.xml'], {'lang': 'es9', 'module': 'goog'}); goog.addDependency('../../blocks/text.js', ['Blockly.Constants.Text', 'Blockly.blocks.texts'], ['Blockly', 'Blockly.FieldDropdown', 'Blockly.FieldImage', 'Blockly.FieldMultilineInput', 'Blockly.FieldTextInput', 'Blockly.FieldVariable', 'Blockly.Mutator'], {'lang': 'es6'}); From b170d86c2e2d78a2afa1edfec6f743314087cc2a Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Tue, 30 Nov 2021 23:24:41 +0000 Subject: [PATCH 3/4] refactor: Migrate blocks/loops.js named requires --- blocks/loops.js | 77 +++++++++++++++++++++-------------- scripts/gulpfiles/chunks.json | 14 +++---- tests/deps.js | 2 +- 3 files changed, 54 insertions(+), 39 deletions(-) diff --git a/blocks/loops.js b/blocks/loops.js index 0524847a4f2..cc86615d61d 100644 --- a/blocks/loops.js +++ b/blocks/loops.js @@ -6,21 +6,36 @@ /** * @fileoverview Loop blocks for Blockly. - * @suppress {extraRequire|missingRequire|checkTypes} + * @suppress {checkTypes} */ 'use strict'; goog.module('Blockly.blocks.loops'); -goog.require('Blockly'); +/* eslint-disable-next-line no-unused-vars */ +const AbstractEvent = goog.requireType('Blockly.Events.Abstract'); +const ContextMenu = goog.require('Blockly.ContextMenu'); +const Events = goog.require('Blockly.Events'); +const Extensions = goog.require('Blockly.Extensions'); +const Msg = goog.require('Blockly.Msg'); +const Variables = goog.require('Blockly.Variables'); +const common = goog.require('Blockly.common'); +const xmlUtils = goog.require('Blockly.utils.xml'); +/* eslint-disable-next-line no-unused-vars */ +const {Block} = goog.requireType('Blockly.Block'); +/** @suppress {extraRequire} */ goog.require('Blockly.FieldDropdown'); +/** @suppress {extraRequire} */ goog.require('Blockly.FieldLabel'); +/** @suppress {extraRequire} */ goog.require('Blockly.FieldNumber'); +/** @suppress {extraRequire} */ goog.require('Blockly.FieldVariable'); +/** @suppress {extraRequire} */ goog.require('Blockly.Warning'); -Blockly.common.defineBlocksWithJsonArray([ +common.defineBlocksWithJsonArray([ // Block for repeat n times (external number). { "type": "controls_repeat_ext", @@ -193,7 +208,7 @@ Blockly.common.defineBlocksWithJsonArray([ /** * Tooltips for the 'controls_whileUntil' block, keyed by MODE value. - * @see {Blockly.Extensions#buildTooltipForDropdown} + * @see {Extensions#buildTooltipForDropdown} * @readonly */ const WHILE_UNTIL_TOOLTIPS = { @@ -201,13 +216,13 @@ const WHILE_UNTIL_TOOLTIPS = { 'UNTIL': '%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}', }; -Blockly.Extensions.register('controls_whileUntil_tooltip', - Blockly.Extensions.buildTooltipForDropdown( +Extensions.register('controls_whileUntil_tooltip', + Extensions.buildTooltipForDropdown( 'MODE', WHILE_UNTIL_TOOLTIPS)); /** * Tooltips for the 'controls_flow_statements' block, keyed by FLOW value. - * @see {Blockly.Extensions#buildTooltipForDropdown} + * @see {Extensions#buildTooltipForDropdown} * @readonly */ const BREAK_CONTINUE_TOOLTIPS = { @@ -215,15 +230,15 @@ const BREAK_CONTINUE_TOOLTIPS = { 'CONTINUE': '%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}', }; -Blockly.Extensions.register('controls_flow_tooltip', - Blockly.Extensions.buildTooltipForDropdown( +Extensions.register('controls_flow_tooltip', + Extensions.buildTooltipForDropdown( 'FLOW', BREAK_CONTINUE_TOOLTIPS)); /** * Mixin to add a context menu item to create a 'variables_get' block. * Used by blocks 'controls_for' and 'controls_forEach'. * @mixin - * @augments Blockly.Block + * @augments Block * @package * @readonly */ @@ -232,7 +247,7 @@ const CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = { * Add context menu option to create getter block for the loop's variable. * (customContextMenu support limited to web BlockSvg.) * @param {!Array} options List of menu options to add to. - * @this {Blockly.Block} + * @this {Block} */ customContextMenu: function(options) { if (this.isInFlyout) { @@ -243,26 +258,26 @@ const CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = { if (!this.isCollapsed() && varName !== null) { const option = {enabled: true}; option.text = - Blockly.Msg['VARIABLES_SET_CREATE_GET'].replace('%1', varName); - const xmlField = Blockly.Variables.generateVariableFieldDom(variable); - const xmlBlock = Blockly.utils.xml.createElement('block'); + Msg['VARIABLES_SET_CREATE_GET'].replace('%1', varName); + const xmlField = Variables.generateVariableFieldDom(variable); + const xmlBlock = xmlUtils.createElement('block'); xmlBlock.setAttribute('type', 'variables_get'); xmlBlock.appendChild(xmlField); - option.callback = Blockly.ContextMenu.callbackFactory(this, xmlBlock); + option.callback = ContextMenu.callbackFactory(this, xmlBlock); options.push(option); } }, }; -Blockly.Extensions.registerMixin('contextMenu_newGetVariableBlock', +Extensions.registerMixin('contextMenu_newGetVariableBlock', CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN); -Blockly.Extensions.register('controls_for_tooltip', - Blockly.Extensions.buildTooltipWithFieldText( +Extensions.register('controls_for_tooltip', + Extensions.buildTooltipWithFieldText( '%{BKY_CONTROLS_FOR_TOOLTIP}', 'VAR')); -Blockly.Extensions.register('controls_forEach_tooltip', - Blockly.Extensions.buildTooltipWithFieldText( +Extensions.register('controls_forEach_tooltip', + Extensions.buildTooltipWithFieldText( '%{BKY_CONTROLS_FOREACH_TOOLTIP}', 'VAR')); /** @@ -292,15 +307,15 @@ exports.loopTypes = loopTypes; * This mixin adds a check to make sure the 'controls_flow_statements' block * is contained in a loop. Otherwise a warning is added to the block. * @mixin - * @augments Blockly.Block + * @augments Block * @public * @readonly */ const CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = { /** * Is this block enclosed (at any level) by a loop? - * @return {Blockly.Block} The nearest surrounding loop, or null if none. - * @this {Blockly.Block} + * @return {Block} The nearest surrounding loop, or null if none. + * @this {Block} */ getSurroundLoop: function() { let block = this; @@ -316,29 +331,29 @@ const CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = { /** * 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} + * @param {!AbstractEvent} e Change event. + * @this {Block} */ onchange: function(e) { // Don't change state if: // * It's at the start of a drag. // * It's not a move event. if (!this.workspace.isDragging || this.workspace.isDragging() || - e.type !== Blockly.Events.BLOCK_MOVE) { + e.type !== Events.BLOCK_MOVE) { return; } const enabled = this.getSurroundLoop(this); this.setWarningText(enabled ? null : - Blockly.Msg['CONTROLS_FLOW_STATEMENTS_WARNING']); + Msg['CONTROLS_FLOW_STATEMENTS_WARNING']); if (!this.isInFlyout) { - const group = Blockly.Events.getGroup(); + const group = Events.getGroup(); // Makes it so the move and the disable event get undone together. - Blockly.Events.setGroup(e.group); + Events.setGroup(e.group); this.setEnabled(enabled); - Blockly.Events.setGroup(group); + Events.setGroup(group); } }, }; -Blockly.Extensions.registerMixin('controls_flow_in_loop_check', +Extensions.registerMixin('controls_flow_in_loop_check', CONTROL_FLOW_IN_LOOP_CHECK_MIXIN); diff --git a/scripts/gulpfiles/chunks.json b/scripts/gulpfiles/chunks.json index ce48d228093..f03e52e2cc9 100644 --- a/scripts/gulpfiles/chunks.json +++ b/scripts/gulpfiles/chunks.json @@ -11,11 +11,6 @@ "js": [ "./core/serialization/workspaces.js", "./core/serialization/variables.js", - "./core/widgetdiv.js", - "./core/clipboard.js", - "./core/menuitem.js", - "./core/menu.js", - "./core/contextmenu.js", "./core/contextmenu_items.js", "./core/shortcut_items.js", "./core/theme/zelos.js", @@ -57,8 +52,6 @@ "./core/field_colour.js", "./core/field_label_serializable.js", "./core/field_multilineinput.js", - "./core/field_number.js", - "./core/field_variable.js", "./core/flyout_metrics_manager.js", "./core/flyout_base.js", "./core/generator.js", @@ -68,11 +61,18 @@ "./core/flyout_vertical.js", "./core/inject.js", "./core/blockly.js", + "./core/field_variable.js", + "./core/field_number.js", "./core/field_dropdown.js", "./core/events/workspace_events.js", "./core/events/events_toolbox_item_select.js", "./core/events/events_ui.js", "./core/events/events.js", + "./core/widgetdiv.js", + "./core/clipboard.js", + "./core/menuitem.js", + "./core/menu.js", + "./core/contextmenu.js", "./core/blocks.js", "./core/utils/useragent.js", "./core/utils/svg.js", diff --git a/tests/deps.js b/tests/deps.js index a4a43defef1..d1007268a38 100644 --- a/tests/deps.js +++ b/tests/deps.js @@ -2,7 +2,7 @@ goog.addDependency('../../blocks/all.js', ['Blockly.blocks.all'], ['Blockly.bloc goog.addDependency('../../blocks/colour.js', ['Blockly.blocks.colour'], ['Blockly.common'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../blocks/lists.js', ['Blockly.blocks.lists'], ['Blockly.ConnectionType', 'Blockly.FieldDropdown', 'Blockly.Input', 'Blockly.Msg', 'Blockly.Mutator', 'Blockly.blocks', 'Blockly.common', 'Blockly.utils.xml'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../blocks/logic.js', ['Blockly.blocks.logic'], ['Blockly.Events', 'Blockly.Extensions', 'Blockly.FieldDropdown', 'Blockly.FieldLabel', 'Blockly.Msg', 'Blockly.Mutator', 'Blockly.common', 'Blockly.utils.xml'], {'lang': 'es6', 'module': 'goog'}); -goog.addDependency('../../blocks/loops.js', ['Blockly.blocks.loops'], ['Blockly', 'Blockly.FieldDropdown', 'Blockly.FieldLabel', 'Blockly.FieldNumber', 'Blockly.FieldVariable', 'Blockly.Warning'], {'lang': 'es6', 'module': 'goog'}); +goog.addDependency('../../blocks/loops.js', ['Blockly.blocks.loops'], ['Blockly.Block', 'Blockly.ContextMenu', 'Blockly.Events', 'Blockly.Events.Abstract', 'Blockly.Extensions', 'Blockly.FieldDropdown', 'Blockly.FieldLabel', 'Blockly.FieldNumber', 'Blockly.FieldVariable', 'Blockly.Msg', 'Blockly.Variables', 'Blockly.Warning', 'Blockly.common', 'Blockly.utils.xml'], {'lang': 'es6', 'module': 'goog'}); goog.addDependency('../../blocks/math.js', ['Blockly.Constants.Math', 'Blockly.blocks.math'], ['Blockly', 'Blockly.FieldDropdown', 'Blockly.FieldLabel', 'Blockly.FieldNumber', 'Blockly.FieldVariable'], {'lang': 'es6'}); goog.addDependency('../../blocks/procedures.js', ['Blockly.blocks.procedures'], ['Blockly.Comment', 'Blockly.ContextMenu', 'Blockly.Events', 'Blockly.FieldCheckbox', 'Blockly.FieldLabel', 'Blockly.FieldTextInput', 'Blockly.Input', 'Blockly.Msg', 'Blockly.Mutator', 'Blockly.Names', 'Blockly.Procedures', 'Blockly.Variables', 'Blockly.Warning', 'Blockly.Xml', 'Blockly.blocks', 'Blockly.internalConstants', 'Blockly.utils.xml'], {'lang': 'es9', 'module': 'goog'}); goog.addDependency('../../blocks/text.js', ['Blockly.Constants.Text', 'Blockly.blocks.texts'], ['Blockly', 'Blockly.FieldDropdown', 'Blockly.FieldImage', 'Blockly.FieldMultilineInput', 'Blockly.FieldTextInput', 'Blockly.FieldVariable', 'Blockly.Mutator'], {'lang': 'es6'}); From 9237e2fcaa095fdbda8543788e687e19208d7f8c Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Tue, 30 Nov 2021 23:29:19 +0000 Subject: [PATCH 4/4] chore: clang-format blocks/loops.js --- blocks/loops.js | 269 ++++++++++++++++++++++++------------------------ 1 file changed, 135 insertions(+), 134 deletions(-) diff --git a/blocks/loops.js b/blocks/loops.js index cc86615d61d..9a40720fa33 100644 --- a/blocks/loops.js +++ b/blocks/loops.js @@ -38,170 +38,170 @@ goog.require('Blockly.Warning'); common.defineBlocksWithJsonArray([ // Block for repeat n times (external number). { - "type": "controls_repeat_ext", - "message0": "%{BKY_CONTROLS_REPEAT_TITLE}", - "args0": [{ - "type": "input_value", - "name": "TIMES", - "check": "Number", + 'type': 'controls_repeat_ext', + 'message0': '%{BKY_CONTROLS_REPEAT_TITLE}', + 'args0': [{ + 'type': 'input_value', + 'name': 'TIMES', + 'check': 'Number', }], - "message1": "%{BKY_CONTROLS_REPEAT_INPUT_DO} %1", - "args1": [{ - "type": "input_statement", - "name": "DO", + 'message1': '%{BKY_CONTROLS_REPEAT_INPUT_DO} %1', + 'args1': [{ + 'type': 'input_statement', + 'name': 'DO', }], - "previousStatement": null, - "nextStatement": null, - "style": "loop_blocks", - "tooltip": "%{BKY_CONTROLS_REPEAT_TOOLTIP}", - "helpUrl": "%{BKY_CONTROLS_REPEAT_HELPURL}", + 'previousStatement': null, + 'nextStatement': null, + 'style': 'loop_blocks', + 'tooltip': '%{BKY_CONTROLS_REPEAT_TOOLTIP}', + 'helpUrl': '%{BKY_CONTROLS_REPEAT_HELPURL}', }, // Block for repeat n times (internal number). // The 'controls_repeat_ext' block is preferred as it is more flexible. { - "type": "controls_repeat", - "message0": "%{BKY_CONTROLS_REPEAT_TITLE}", - "args0": [{ - "type": "field_number", - "name": "TIMES", - "value": 10, - "min": 0, - "precision": 1, + 'type': 'controls_repeat', + 'message0': '%{BKY_CONTROLS_REPEAT_TITLE}', + 'args0': [{ + 'type': 'field_number', + 'name': 'TIMES', + 'value': 10, + 'min': 0, + 'precision': 1, }], - "message1": "%{BKY_CONTROLS_REPEAT_INPUT_DO} %1", - "args1": [{ - "type": "input_statement", - "name": "DO", + 'message1': '%{BKY_CONTROLS_REPEAT_INPUT_DO} %1', + 'args1': [{ + 'type': 'input_statement', + 'name': 'DO', }], - "previousStatement": null, - "nextStatement": null, - "style": "loop_blocks", - "tooltip": "%{BKY_CONTROLS_REPEAT_TOOLTIP}", - "helpUrl": "%{BKY_CONTROLS_REPEAT_HELPURL}", + 'previousStatement': null, + 'nextStatement': null, + 'style': 'loop_blocks', + 'tooltip': '%{BKY_CONTROLS_REPEAT_TOOLTIP}', + 'helpUrl': '%{BKY_CONTROLS_REPEAT_HELPURL}', }, // Block for 'do while/until' loop. { - "type": "controls_whileUntil", - "message0": "%1 %2", - "args0": [ + 'type': 'controls_whileUntil', + 'message0': '%1 %2', + 'args0': [ { - "type": "field_dropdown", - "name": "MODE", - "options": [ - ["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}", "WHILE"], - ["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}", "UNTIL"], + 'type': 'field_dropdown', + 'name': 'MODE', + 'options': [ + ['%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}', 'WHILE'], + ['%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}', 'UNTIL'], ], }, { - "type": "input_value", - "name": "BOOL", - "check": "Boolean", + 'type': 'input_value', + 'name': 'BOOL', + 'check': 'Boolean', }, ], - "message1": "%{BKY_CONTROLS_REPEAT_INPUT_DO} %1", - "args1": [{ - "type": "input_statement", - "name": "DO", + 'message1': '%{BKY_CONTROLS_REPEAT_INPUT_DO} %1', + 'args1': [{ + 'type': 'input_statement', + 'name': 'DO', }], - "previousStatement": null, - "nextStatement": null, - "style": "loop_blocks", - "helpUrl": "%{BKY_CONTROLS_WHILEUNTIL_HELPURL}", - "extensions": ["controls_whileUntil_tooltip"], + 'previousStatement': null, + 'nextStatement': null, + 'style': 'loop_blocks', + 'helpUrl': '%{BKY_CONTROLS_WHILEUNTIL_HELPURL}', + 'extensions': ['controls_whileUntil_tooltip'], }, // Block for 'for' loop. { - "type": "controls_for", - "message0": "%{BKY_CONTROLS_FOR_TITLE}", - "args0": [ + 'type': 'controls_for', + 'message0': '%{BKY_CONTROLS_FOR_TITLE}', + 'args0': [ { - "type": "field_variable", - "name": "VAR", - "variable": null, + 'type': 'field_variable', + 'name': 'VAR', + 'variable': null, }, { - "type": "input_value", - "name": "FROM", - "check": "Number", - "align": "RIGHT", + 'type': 'input_value', + 'name': 'FROM', + 'check': 'Number', + 'align': 'RIGHT', }, { - "type": "input_value", - "name": "TO", - "check": "Number", - "align": "RIGHT", + 'type': 'input_value', + 'name': 'TO', + 'check': 'Number', + 'align': 'RIGHT', }, { - "type": "input_value", - "name": "BY", - "check": "Number", - "align": "RIGHT", + 'type': 'input_value', + 'name': 'BY', + 'check': 'Number', + 'align': 'RIGHT', }, ], - "message1": "%{BKY_CONTROLS_REPEAT_INPUT_DO} %1", - "args1": [{ - "type": "input_statement", - "name": "DO", + 'message1': '%{BKY_CONTROLS_REPEAT_INPUT_DO} %1', + 'args1': [{ + 'type': 'input_statement', + 'name': 'DO', }], - "inputsInline": true, - "previousStatement": null, - "nextStatement": null, - "style": "loop_blocks", - "helpUrl": "%{BKY_CONTROLS_FOR_HELPURL}", - "extensions": [ - "contextMenu_newGetVariableBlock", - "controls_for_tooltip", + 'inputsInline': true, + 'previousStatement': null, + 'nextStatement': null, + 'style': 'loop_blocks', + 'helpUrl': '%{BKY_CONTROLS_FOR_HELPURL}', + 'extensions': [ + 'contextMenu_newGetVariableBlock', + 'controls_for_tooltip', ], }, // Block for 'for each' loop. { - "type": "controls_forEach", - "message0": "%{BKY_CONTROLS_FOREACH_TITLE}", - "args0": [ + 'type': 'controls_forEach', + 'message0': '%{BKY_CONTROLS_FOREACH_TITLE}', + 'args0': [ { - "type": "field_variable", - "name": "VAR", - "variable": null, + 'type': 'field_variable', + 'name': 'VAR', + 'variable': null, }, { - "type": "input_value", - "name": "LIST", - "check": "Array", + 'type': 'input_value', + 'name': 'LIST', + 'check': 'Array', }, ], - "message1": "%{BKY_CONTROLS_REPEAT_INPUT_DO} %1", - "args1": [{ - "type": "input_statement", - "name": "DO", + 'message1': '%{BKY_CONTROLS_REPEAT_INPUT_DO} %1', + 'args1': [{ + 'type': 'input_statement', + 'name': 'DO', }], - "previousStatement": null, - "nextStatement": null, - "style": "loop_blocks", - "helpUrl": "%{BKY_CONTROLS_FOREACH_HELPURL}", - "extensions": [ - "contextMenu_newGetVariableBlock", - "controls_forEach_tooltip", + 'previousStatement': null, + 'nextStatement': null, + 'style': 'loop_blocks', + 'helpUrl': '%{BKY_CONTROLS_FOREACH_HELPURL}', + 'extensions': [ + 'contextMenu_newGetVariableBlock', + 'controls_forEach_tooltip', ], }, // Block for flow statements: continue, break. { - "type": "controls_flow_statements", - "message0": "%1", - "args0": [{ - "type": "field_dropdown", - "name": "FLOW", - "options": [ - ["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}", "BREAK"], - ["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}", "CONTINUE"], + 'type': 'controls_flow_statements', + 'message0': '%1', + 'args0': [{ + 'type': 'field_dropdown', + 'name': 'FLOW', + 'options': [ + ['%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}', 'BREAK'], + ['%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}', 'CONTINUE'], ], }], - "previousStatement": null, - "style": "loop_blocks", - "helpUrl": "%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}", - "suppressPrefixSuffix": true, - "extensions": [ - "controls_flow_tooltip", - "controls_flow_in_loop_check", + 'previousStatement': null, + 'style': 'loop_blocks', + 'helpUrl': '%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}', + 'suppressPrefixSuffix': true, + 'extensions': [ + 'controls_flow_tooltip', + 'controls_flow_in_loop_check', ], }, ]); @@ -216,9 +216,9 @@ const WHILE_UNTIL_TOOLTIPS = { 'UNTIL': '%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}', }; -Extensions.register('controls_whileUntil_tooltip', - Extensions.buildTooltipForDropdown( - 'MODE', WHILE_UNTIL_TOOLTIPS)); +Extensions.register( + 'controls_whileUntil_tooltip', + Extensions.buildTooltipForDropdown('MODE', WHILE_UNTIL_TOOLTIPS)); /** * Tooltips for the 'controls_flow_statements' block, keyed by FLOW value. @@ -230,9 +230,9 @@ const BREAK_CONTINUE_TOOLTIPS = { 'CONTINUE': '%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}', }; -Extensions.register('controls_flow_tooltip', - Extensions.buildTooltipForDropdown( - 'FLOW', BREAK_CONTINUE_TOOLTIPS)); +Extensions.register( + 'controls_flow_tooltip', + Extensions.buildTooltipForDropdown('FLOW', BREAK_CONTINUE_TOOLTIPS)); /** * Mixin to add a context menu item to create a 'variables_get' block. @@ -257,8 +257,7 @@ const CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = { const varName = variable.name; if (!this.isCollapsed() && varName !== null) { const option = {enabled: true}; - option.text = - Msg['VARIABLES_SET_CREATE_GET'].replace('%1', varName); + option.text = Msg['VARIABLES_SET_CREATE_GET'].replace('%1', varName); const xmlField = Variables.generateVariableFieldDom(variable); const xmlBlock = xmlUtils.createElement('block'); xmlBlock.setAttribute('type', 'variables_get'); @@ -269,14 +268,16 @@ const CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = { }, }; -Extensions.registerMixin('contextMenu_newGetVariableBlock', +Extensions.registerMixin( + 'contextMenu_newGetVariableBlock', CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN); -Extensions.register('controls_for_tooltip', - Extensions.buildTooltipWithFieldText( - '%{BKY_CONTROLS_FOR_TOOLTIP}', 'VAR')); +Extensions.register( + 'controls_for_tooltip', + Extensions.buildTooltipWithFieldText('%{BKY_CONTROLS_FOR_TOOLTIP}', 'VAR')); -Extensions.register('controls_forEach_tooltip', +Extensions.register( + 'controls_forEach_tooltip', Extensions.buildTooltipWithFieldText( '%{BKY_CONTROLS_FOREACH_TOOLTIP}', 'VAR')); @@ -343,8 +344,8 @@ const CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = { return; } const enabled = this.getSurroundLoop(this); - this.setWarningText(enabled ? null : - Msg['CONTROLS_FLOW_STATEMENTS_WARNING']); + this.setWarningText( + enabled ? null : Msg['CONTROLS_FLOW_STATEMENTS_WARNING']); if (!this.isInFlyout) { const group = Events.getGroup(); // Makes it so the move and the disable event get undone together. @@ -355,5 +356,5 @@ const CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = { }, }; -Extensions.registerMixin('controls_flow_in_loop_check', - CONTROL_FLOW_IN_LOOP_CHECK_MIXIN); +Extensions.registerMixin( + 'controls_flow_in_loop_check', CONTROL_FLOW_IN_LOOP_CHECK_MIXIN);