summaryrefslogtreecommitdiff
path: root/test/wasm2js.asserts.js
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2021-06-17 10:53:54 -0400
committerGitHub <noreply@github.com>2021-06-17 14:53:54 +0000
commitfb9d2a779c0267b9348bb87a9de6974658dda69d (patch)
tree267b8ec888592959abe8c9dc53bc84cc49119cd3 /test/wasm2js.asserts.js
parentc36c6fa9e42f4e917864312780ba95fb996eda79 (diff)
downloadbinaryen-fb9d2a779c0267b9348bb87a9de6974658dda69d.tar.gz
binaryen-fb9d2a779c0267b9348bb87a9de6974658dda69d.tar.bz2
binaryen-fb9d2a779c0267b9348bb87a9de6974658dda69d.zip
[wasm2js] Refactor assertion parsing (#3938)
Assertions were previously parsed by replacing "invoke" with "call" and using the normal s-expr parser. The parseCall method of the s-expr parser uses the call target to look up the correct signature on the module, but the invoke targets in assertions use export names rather than internal function names, so the signature lookups were inserting new bogus entries with default values. This issue didn't seem to cause any big problems before, but #3935 turns it into a hard error because the default `HeapType` does not have an associated signature. Fix the problem (at least in the common case of trivial arguments and expected results) by manually construction a `Call` expression rather than depending on the s-expr parser to construct it.
Diffstat (limited to 'test/wasm2js.asserts.js')
-rw-r--r--test/wasm2js.asserts.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/wasm2js.asserts.js b/test/wasm2js.asserts.js
index 6ff356893..2770c07dd 100644
--- a/test/wasm2js.asserts.js
+++ b/test/wasm2js.asserts.js
@@ -74,9 +74,9 @@ function check1() {
return 1 | 0;
}
-if (!check1()) throw 'assertion failed: ( assert_return ( call $empty ) )';
+if (!check1()) throw 'assertion failed: ( assert_return ( invoke empty ) )';
function check2() {
return (retasmFunc0.add(1 | 0, 1 | 0) | 0 | 0) == (2 | 0) | 0;
}
-if (!check2()) throw 'assertion failed: ( assert_return ( call $add ( i32.const 1 ) ( i32.const 1 ) ) ( i32.const 2 ) )';
+if (!check2()) throw 'assertion failed: ( assert_return ( invoke add ( i32.const 1 ) ( i32.const 1 ) ) ( i32.const 2 ) )';