js: reset variable types after compatibility layer call

Fixes https://github.com/TurboWarp/scratch-vm/issues/245
This commit is contained in:
Muffin committed 2025-02-11 00:49:36 -06:00
1 parent af3b7513a4
commit cd63c87f07
4 files changed
+70

No files matched your search

+2
View File
@@ -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;
}
Binary file not shown.
@@ -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;
}; })
@@ -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;
}; })