@@ -59,6 +59,8 @@ Blockly.Blocks['control_forever'] = {
5959 "category" : Blockly . Categories . control ,
6060 "extensions" : [ "colours_control" , "shape_statement" ]
6161 } ) ;
62+
63+ this . nextStatementIsDynamic_ = true ;
6264 this . setNextStatement ( false ) ;
6365 this . hasBreak_ = false ;
6466 } ,
@@ -1269,8 +1271,8 @@ Blockly.Blocks['control_exitLoop'] = {
12691271
12701272 this . oldLoopBlock = null ;
12711273
1272- // its rather expensive to start listening to Blockly Events, its lighter to
1273- // patch these functions for this specific block
1274+ // its rather expensive to start listening to Blockly Events, its better
1275+ // to patch these functions for this specific block
12741276 this . originalSetDraggingFunc = this . setDragging ;
12751277 this . setDragging = function ( adding ) {
12761278 this . originalSetDraggingFunc . call ( this , adding ) ;
@@ -1304,7 +1306,7 @@ Blockly.Blocks['control_exitLoop'] = {
13041306 // recursively climb tree until we reach a forever loop block
13051307 let parent = this . getParent ( ) ;
13061308 while ( parent !== null ) {
1307- if ( parent . type === "control_forever" ) {
1309+ if ( parent . nextStatementIsDynamic_ ) {
13081310 // a smart way to check if we are a child is by checking our position
13091311 // child blocks are not aligned on the x axis
13101312 var childPos = this . getRelativeToSurfaceXY ( ) ;
0 commit comments