diff --git a/src/compiler/irgen.js b/src/compiler/irgen.js index 39707ef5c6c..b1b8ded5e38 100644 --- a/src/compiler/irgen.js +++ b/src/compiler/irgen.js @@ -202,7 +202,7 @@ class ScriptTreeGenerator { }; } return { - kind: 'args.stringNumber', + kind: 'procedures.argument', index: index }; } @@ -223,7 +223,7 @@ class ScriptTreeGenerator { }; } return { - kind: 'args.boolean', + kind: 'procedures.argument', index: index }; } diff --git a/src/compiler/jsgen.js b/src/compiler/jsgen.js index d3e7784d81f..914e5cc72b1 100644 --- a/src/compiler/jsgen.js +++ b/src/compiler/jsgen.js @@ -433,11 +433,6 @@ class JSGenerator { case 'addons.call': return new TypedInput(`(${this.descendAddonCall(node)})`, TYPE_UNKNOWN); - case 'args.boolean': - return new TypedInput(`toBoolean(p${node.index})`, TYPE_BOOLEAN); - case 'args.stringNumber': - return new TypedInput(`p${node.index}`, TYPE_UNKNOWN); - case 'compat': // Compatibility layer inputs never use flags. return new TypedInput(`(${this.generateCompatibilityLayerCall(node, false)})`, TYPE_UNKNOWN); @@ -665,6 +660,8 @@ class JSGenerator { } return new TypedInput(`${procedureReference}(${joinedArgs})`, TYPE_UNKNOWN); } + case 'procedures.argument': + return new TypedInput(`p${node.index}`, TYPE_UNKNOWN); case 'sensing.answer': return new TypedInput(`runtime.ext_scratch3_sensing._answer`, TYPE_STRING); diff --git a/test/fixtures/execute/tw-boolean-arguments-are-not-cast.sb3 b/test/fixtures/execute/tw-boolean-arguments-are-not-cast.sb3 new file mode 100644 index 00000000000..05db1b3f716 Binary files /dev/null and b/test/fixtures/execute/tw-boolean-arguments-are-not-cast.sb3 differ diff --git a/test/snapshot/__snapshots__/tw-boolean-arguments-are-not-cast.sb3.tw-snapshot b/test/snapshot/__snapshots__/tw-boolean-arguments-are-not-cast.sb3.tw-snapshot new file mode 100644 index 00000000000..11149718950 --- /dev/null +++ b/test/snapshot/__snapshots__/tw-boolean-arguments-are-not-cast.sb3.tw-snapshot @@ -0,0 +1,24 @@ +// TW Snapshot +// Input SHA-256: b157139c7d41cd5d9bc1829c714121545a8e42ea64c094db8081d9741b032be0 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "f", null); +yield* thread.procedures["ZBlock A %s"]("Hai!!!"); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "k", null); +retire(); return; +}; }) + +// Sprite1 ZBlock A %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_Block_A_ (p0) { +if ((("" + p0).toLowerCase() === "Hai!!!".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass did not cast",}, b0, false, false, "m", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail was casted",}, b0, false, false, "n", null); +} +return ""; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/tw-boolean-arguments-are-not-cast.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/tw-boolean-arguments-are-not-cast.sb3.tw-snapshot new file mode 100644 index 00000000000..11149718950 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/tw-boolean-arguments-are-not-cast.sb3.tw-snapshot @@ -0,0 +1,24 @@ +// TW Snapshot +// Input SHA-256: b157139c7d41cd5d9bc1829c714121545a8e42ea64c094db8081d9741b032be0 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "f", null); +yield* thread.procedures["ZBlock A %s"]("Hai!!!"); +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "k", null); +retire(); return; +}; }) + +// Sprite1 ZBlock A %s +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ_Block_A_ (p0) { +if ((("" + p0).toLowerCase() === "Hai!!!".toLowerCase())) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass did not cast",}, b0, false, false, "m", null); +} else { +yield* executeInCompatibilityLayer({"MESSAGE":"fail was casted",}, b0, false, false, "n", null); +} +return ""; +}; })