Skip to content

Commit 16415ba

Browse files
committed
Use procedure variant in snapshots instead of just procedure code
1 parent 6ce931b commit 16415ba

File tree

31 files changed

+76
-69
lines changed

31 files changed

+76
-69
lines changed

src/compiler/intermediate.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ class IntermediateScript {
2626
*/
2727
this.isProcedure = false;
2828

29+
/**
30+
* This procedure's variant, if any.
31+
* @type {string}
32+
*/
33+
this.procedureVariant = '';
34+
2935
/**
3036
* This procedure's code, if any.
3137
* @type {string}

src/compiler/irgen.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class ScriptTreeGenerator {
8787
setProcedureVariant (procedureVariant) {
8888
const procedureCode = parseProcedureCode(procedureVariant);
8989

90+
this.script.procedureVariant = procedureVariant;
9091
this.script.procedureCode = procedureCode;
9192
this.script.isProcedure = true;
9293
this.script.yields = false;

test/snapshot/__snapshots__/tw-comparison-matrix-runtime.sb3.tw-snapshot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "aZ", n
1111
retire(); return;
1212
}; })
1313

14-
// Sprite1 run test
14+
// Sprite1 Wrun test
1515
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
1616
const b0 = stage.variables["mfV;yS}9e:%h5UZ)QyiY"];
1717
const b1 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"];
@@ -46,7 +46,7 @@ if (hasResumedFromPromise) {hasResumedFromPromise = false;continue;}
4646
return "";
4747
}; })
4848

49-
// Sprite1 setup values
49+
// Sprite1 Wsetup values
5050
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
5151
const b0 = stage.variables["n^wm8jw#b24sggt.S^tD"];
5252
return function funXYZ_setup_values () {

test/snapshot/__snapshots__/tw-custom-report-repeat.sb3.tw-snapshot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "l", nu
1919
retire(); return;
2020
}; })
2121

22-
// Sprite1 block name
22+
// Sprite1 Zblock name
2323
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
2424
return function funXYZ_block_name () {
2525
return 40;

test/snapshot/__snapshots__/tw-forkphorus-515-wait-zero-seconds-in-warp-mode.sb3.tw-snapshot

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ retire(); return;
2121
retire(); return;
2222
}; })
2323

24-
// Sprite1 no refresh
24+
// Sprite1 Wno refresh
2525
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
2626
const b0 = runtime.getOpcodeFunction("music_restForBeats");
2727
const b1 = runtime.getOpcodeFunction("music_playDrumForBeats");
@@ -41,14 +41,14 @@ runtime.ext_scratch3_motion._moveSteps(0, target);
4141
return "";
4242
}; })
4343

44-
// Sprite1 runs below with no refresh
44+
// Sprite1 Wruns below with no refresh
4545
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
4646
return function* genXYZ_runs_below_with_no_r () {
4747
yield* thread.procedures["Whas refresh"]();
4848
return "";
4949
}; })
5050

51-
// Sprite1 has refresh
51+
// Sprite1 Whas refresh
5252
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
5353
const b0 = runtime.getOpcodeFunction("music_restForBeats");
5454
const b1 = runtime.getOpcodeFunction("music_playDrumForBeats");

test/snapshot/__snapshots__/tw-gh-201-stop-script-does-not-reevaluate-arguments.sb3.tw-snapshot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "g", nu
1111
retire(); return;
1212
}; })
1313

14-
// Sprite1 foo %s
14+
// Sprite1 Zfoo %s
1515
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
1616
return function funXYZ_foo_ (p0) {
1717
return "";
1818
return "";
1919
}; })
2020

21-
// Sprite1 no op
21+
// Sprite1 Zno op
2222
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
2323
return function funXYZ_no_op () {
2424
return "";

test/snapshot/__snapshots__/tw-prefers-first-occurence-of-procedure-387608267.sb3.tw-snapshot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "Q^(MKg
1111
retire(); return;
1212
}; })
1313

14-
// Player Set Costume
14+
// Player ZSet Costume
1515
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
1616
const b0 = runtime.getOpcodeFunction("looks_say");
1717
return function* genXYZ_Set_Costume () {

test/snapshot/__snapshots__/tw-procedure-arguments-with-same-name.sb3.tw-snapshot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "$R-1lb
1212
retire(); return;
1313
}; })
1414

15-
// Sprite1 number or text %s %s
15+
// Sprite1 Znumber or text %s %s
1616
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
1717
const b0 = runtime.getOpcodeFunction("looks_say");
1818
return function* genXYZ_number_or_text__ (p0,p1) {
@@ -22,7 +22,7 @@ yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "HH`yR
2222
return "";
2323
}; })
2424

25-
// Sprite1 boolean %b %b
25+
// Sprite1 Zboolean %b %b
2626
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
2727
const b0 = runtime.getOpcodeFunction("looks_say");
2828
return function* genXYZ_boolean__ (p0,p1) {

test/snapshot/__snapshots__/tw-procedure-call-resets-variable-input-types-430811055.sb3.tw-snapshot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, ",vD-ZG
1616
retire(); return;
1717
}; })
1818

19-
// Sprite1 do something
19+
// Sprite1 Zdo something
2020
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
2121
const b0 = stage.variables["`jEk@4|i[#Fk?(8x)AV.-my variable"];
2222
return function funXYZ_do_something () {

test/snapshot/__snapshots__/tw-procedure-return-non-existant.sb3.tw-snapshot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "P", nu
3939
retire(); return;
4040
}; })
4141

42-
// Sprite1 invalid params - reporter
42+
// Sprite1 Zinvalid params - reporter
4343
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
4444
return function funXYZ_invalid_params___rep () {
4545
return 0;
4646
return "";
4747
}; })
4848

49-
// Sprite1 invalid params - boolean
49+
// Sprite1 Zinvalid params - boolean
5050
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
5151
return function funXYZ_invalid_params___boo () {
5252
return 0;

0 commit comments

Comments
 (0)