Skip to content

Commit 7cc8f58

Browse files
committed
Fix yielding loop arguments not re-analyzing
1 parent d8c73c7 commit 7cc8f58

5 files changed

+7
-5
lines changed

src/compiler/iroptimizer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,11 +620,13 @@ class IROptimizer {
620620
*/
621621
analyzeLoopedStack (stack, state, block) {
622622
if (block.yields && !this.ignoreYields) {
623-
const modified = state.clear();
623+
let modified = state.clear();
624624
block.entryState = state.clone();
625625
block.exitState = state.clone();
626+
modified = this.analyzeInputs(block.inputs, state) || modified;
626627
return this.analyzeStack(stack, state) || modified;
627628
}
629+
628630
let modified = false;
629631
let keepLooping;
630632
do {

test/snapshot/__snapshots__/tw-warp-repeat-until-timer-greater-than.sb3.tw-snapshot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const b1 = runtime.getOpcodeFunction("looks_say");
1818
return function* genXYZ_run_without_screen_r () {
1919
b0.value = ((daysSince2000() * 86400) + 3);
2020
runtime.ioDevices.clock.resetProjectTimer();
21-
while (!((runtime.ioDevices.clock.projectTimer() > 0.1) || ((daysSince2000() * 86400) > b0.value))) {
21+
while (!((runtime.ioDevices.clock.projectTimer() > 0.1) || compareGreaterThan((daysSince2000() * 86400), b0.value))) {
2222
if (isStuck()) yield;
2323
}
2424
if (compareLessThan((daysSince2000() * 86400), b0.value)) {

test/snapshot/__snapshots__/tw-zombie-cube-escape-284516654.sb3.tw-snapshot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ return function* genXYZ () {
1010
yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, ",a.euo_AgQTxR+D^x0M0", null);
1111
b1.value = 0;
1212
b2.value = "";
13-
while (!(b2.value.toLowerCase() > "".toLowerCase())) {
13+
while (!(("" + b2.value).toLowerCase() > "".toLowerCase())) {
1414
startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "step" });
1515
yield;
1616
}

test/snapshot/__snapshots__/warp-timer/tw-warp-repeat-until-timer-greater-than.sb3.tw-snapshot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const b1 = runtime.getOpcodeFunction("looks_say");
1818
return function* genXYZ_run_without_screen_r () {
1919
b0.value = ((daysSince2000() * 86400) + 3);
2020
runtime.ioDevices.clock.resetProjectTimer();
21-
while (!((runtime.ioDevices.clock.projectTimer() > 0.1) || ((daysSince2000() * 86400) > b0.value))) {
21+
while (!((runtime.ioDevices.clock.projectTimer() > 0.1) || compareGreaterThan((daysSince2000() * 86400), b0.value))) {
2222
if (isStuck()) yield;
2323
}
2424
if (compareLessThan((daysSince2000() * 86400), b0.value)) {

test/snapshot/__snapshots__/warp-timer/tw-zombie-cube-escape-284516654.sb3.tw-snapshot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ return function* genXYZ () {
1010
yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, ",a.euo_AgQTxR+D^x0M0", null);
1111
b1.value = 0;
1212
b2.value = "";
13-
while (!(b2.value.toLowerCase() > "".toLowerCase())) {
13+
while (!(("" + b2.value).toLowerCase() > "".toLowerCase())) {
1414
startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: "step" });
1515
yield;
1616
}

0 commit comments

Comments
 (0)