mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
refactor: Migrate blocks/loops.js to goog.module syntax (#5755)
* 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.) * refactor: Migrate blocks/loops.js to goog.module * refactor: Migrate blocks/loops.js named requires * chore: clang-format blocks/loops.js
This commit is contained in:
committed by
GitHub
parent
874bbc13c9
commit
208d2008a3
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user