diff --git a/src/compiler/jsgen.js b/src/compiler/jsgen.js index 914e5cc7..10387a79 100644 --- a/src/compiler/jsgen.js +++ b/src/compiler/jsgen.js @@ -1342,6 +1342,8 @@ class JSGenerator { const opcodeFunction = this.evaluateOnce(`runtime.getOpcodeFunction("${sanitize(opcode)}")`); result += `}, ${opcodeFunction}, ${this.isWarp}, ${setFlags}, "${sanitize(node.id)}", ${frameName})`; + this.yielded(); + return result; } diff --git a/test/fixtures/execute/tw-compatibility-layer-type-barrier.sb3 b/test/fixtures/execute/tw-compatibility-layer-type-barrier.sb3 new file mode 100644 index 00000000..635f80d5 Binary files /dev/null and b/test/fixtures/execute/tw-compatibility-layer-type-barrier.sb3 differ diff --git a/test/snapshot/__snapshots__/tw-compatibility-layer-type-barrier.sb3.tw-snapshot b/test/snapshot/__snapshots__/tw-compatibility-layer-type-barrier.sb3.tw-snapshot new file mode 100644 index 00000000..1ffc985c --- /dev/null +++ b/test/snapshot/__snapshots__/tw-compatibility-layer-type-barrier.sb3.tw-snapshot @@ -0,0 +1,34 @@ +// TW Snapshot +// Input SHA-256: 7be6188a713254fa9b1f4ca207fbb6116aad958f321cd54f4f07f49a9f2c1a58 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +const b2 = runtime.getOpcodeFunction("looks_sayforsecs"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "c", null); +b1.value = (0 + 0); +yield* executeInCompatibilityLayer({"MESSAGE":"Hello!","SECS":0.1,}, b2, false, false, "d", null); +if (((((+b1.value || 0) + 2) || 0) === 2)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "i", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "m", null); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +return function* genXYZ () { +thread.timer = timer(); +var a0 = Math.max(0, 1000 * 0); +runtime.requestRedraw(); +yield; +while (thread.timer.timeElapsed() < a0) { +yield; +} +thread.timer = null; +b0.value = "string"; +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/tw-compatibility-layer-type-barrier.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/tw-compatibility-layer-type-barrier.sb3.tw-snapshot new file mode 100644 index 00000000..1ffc985c --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/tw-compatibility-layer-type-barrier.sb3.tw-snapshot @@ -0,0 +1,34 @@ +// TW Snapshot +// Input SHA-256: 7be6188a713254fa9b1f4ca207fbb6116aad958f321cd54f4f07f49a9f2c1a58 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +const b2 = runtime.getOpcodeFunction("looks_sayforsecs"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "c", null); +b1.value = (0 + 0); +yield* executeInCompatibilityLayer({"MESSAGE":"Hello!","SECS":0.1,}, b2, false, false, "d", null); +if (((((+b1.value || 0) + 2) || 0) === 2)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "i", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "m", null); +retire(); return; +}; }) + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"]; +return function* genXYZ () { +thread.timer = timer(); +var a0 = Math.max(0, 1000 * 0); +runtime.requestRedraw(); +yield; +while (thread.timer.timeElapsed() < a0) { +yield; +} +thread.timer = null; +b0.value = "string"; +retire(); return; +}; })