Skip to content

Commit cd63c87

Browse files
committed
js: reset variable types after compatibility layer call
Fixes #245
1 parent af3b751 commit cd63c87

File tree

4 files changed

+70
-0
lines changed

4 files changed

+70
-0
lines changed

src/compiler/jsgen.js

+2
Original file line numberDiff line numberDiff line change
@@ -1342,6 +1342,8 @@ class JSGenerator {
13421342
const opcodeFunction = this.evaluateOnce(`runtime.getOpcodeFunction("${sanitize(opcode)}")`);
13431343
result += `}, ${opcodeFunction}, ${this.isWarp}, ${setFlags}, "${sanitize(node.id)}", ${frameName})`;
13441344

1345+
this.yielded();
1346+
13451347
return result;
13461348
}
13471349

Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// TW Snapshot
2+
// Input SHA-256: 7be6188a713254fa9b1f4ca207fbb6116aad958f321cd54f4f07f49a9f2c1a58
3+
4+
// Sprite1 script
5+
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
6+
const b0 = runtime.getOpcodeFunction("looks_say");
7+
const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"];
8+
const b2 = runtime.getOpcodeFunction("looks_sayforsecs");
9+
return function* genXYZ () {
10+
yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "c", null);
11+
b1.value = (0 + 0);
12+
yield* executeInCompatibilityLayer({"MESSAGE":"Hello!","SECS":0.1,}, b2, false, false, "d", null);
13+
if (((((+b1.value || 0) + 2) || 0) === 2)) {
14+
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "i", null);
15+
}
16+
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "m", null);
17+
retire(); return;
18+
}; })
19+
20+
// Sprite1 script
21+
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
22+
const b0 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"];
23+
return function* genXYZ () {
24+
thread.timer = timer();
25+
var a0 = Math.max(0, 1000 * 0);
26+
runtime.requestRedraw();
27+
yield;
28+
while (thread.timer.timeElapsed() < a0) {
29+
yield;
30+
}
31+
thread.timer = null;
32+
b0.value = "string";
33+
retire(); return;
34+
}; })
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// TW Snapshot
2+
// Input SHA-256: 7be6188a713254fa9b1f4ca207fbb6116aad958f321cd54f4f07f49a9f2c1a58
3+
4+
// Sprite1 script
5+
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
6+
const b0 = runtime.getOpcodeFunction("looks_say");
7+
const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"];
8+
const b2 = runtime.getOpcodeFunction("looks_sayforsecs");
9+
return function* genXYZ () {
10+
yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "c", null);
11+
b1.value = (0 + 0);
12+
yield* executeInCompatibilityLayer({"MESSAGE":"Hello!","SECS":0.1,}, b2, false, false, "d", null);
13+
if (((((+b1.value || 0) + 2) || 0) === 2)) {
14+
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "i", null);
15+
}
16+
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "m", null);
17+
retire(); return;
18+
}; })
19+
20+
// Sprite1 script
21+
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
22+
const b0 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"];
23+
return function* genXYZ () {
24+
thread.timer = timer();
25+
var a0 = Math.max(0, 1000 * 0);
26+
runtime.requestRedraw();
27+
yield;
28+
while (thread.timer.timeElapsed() < a0) {
29+
yield;
30+
}
31+
thread.timer = null;
32+
b0.value = "string";
33+
retire(); return;
34+
}; })

0 commit comments

Comments
 (0)