Skip to content

Commit 1d6f1d2

Browse files
authored
6.7% better code
1 parent 7adcb80 commit 1d6f1d2

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

blocks_vertical/control.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,18 +1290,18 @@ Blockly.Blocks['control_exitLoop'] = {
12901290
// recursively climb tree until we reach a forever loop block
12911291
let parent = this.getParent();
12921292
while (parent !== null) {
1293-
if (parent && parent.type === "control_forever") {
1293+
if (parent.type === "control_forever") {
12941294
// a smart way to check if we are a child is by checking our position
12951295
// child blocks are not aligned on the x axis
12961296
var childPos = this.getRelativeToSurfaceXY();
12971297
var parentPos = parent.getRelativeToSurfaceXY();
1298-
if (Math.round(childPos.x) !== Math.round(parentPos.x)) callback(parent);
1299-
return;
1298+
if (Math.round(childPos.x) !== Math.round(parentPos.x)) {
1299+
callback(parent);
1300+
return;
1301+
}
13001302
}
13011303

1302-
var nextParent = parent.getParent();
1303-
if (nextParent) parent = nextParent;
1304-
else break;
1304+
parent = parent.getParent();
13051305
}
13061306
},
13071307
updateForeverMutation: function(oldMutation, foreverBlock) {

0 commit comments

Comments
 (0)