Add prefix/suffix to orphaned value blocks.

Also respect suppressPrefixSuffix on loops when generating prefix/suffix with continue/break blocks.
This commit is contained in:
Neil Fraser
2019-05-15 17:03:21 -07:00
committed by Neil Fraser
parent 32631577a4
commit 05253d0766
6 changed files with 13 additions and 7 deletions

View File

@@ -180,7 +180,7 @@ Blockly.JavaScript['controls_flow_statements'] = function(block) {
if (Blockly.JavaScript.STATEMENT_PREFIX) {
var loop = Blockly.Constants.Loops
.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(block);
if (loop) {
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.
// In the case of 'break', a prefix is needed due to the loop's suffix.