summaryrefslogtreecommitdiff
path: root/test/binaryen.js/emit_asmjs.js
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-01-15 01:00:08 +0100
committerAlon Zakai <azakai@google.com>2020-01-14 16:00:08 -0800
commit5ca79a71b2a2379083093d4d9136b2ae4095dfe8 (patch)
tree80263fb09290b896362a36d3ae062ee6cb64fb8c /test/binaryen.js/emit_asmjs.js
parenta43b533b0778a1daf47178a3d3d9e559f3d390ed (diff)
downloadbinaryen-5ca79a71b2a2379083093d4d9136b2ae4095dfe8.tar.gz
binaryen-5ca79a71b2a2379083093d4d9136b2ae4095dfe8.tar.bz2
binaryen-5ca79a71b2a2379083093d4d9136b2ae4095dfe8.zip
Align binaryen.js with the npm package (#2551)
Binaryen.js now uses binaryen (was Binaryen) as its global name to align with the npm package. Also fixes issues with emitting and testing both the JS and Wasm builds.
Diffstat (limited to 'test/binaryen.js/emit_asmjs.js')
-rw-r--r--test/binaryen.js/emit_asmjs.js18
1 files changed, 5 insertions, 13 deletions
diff --git a/test/binaryen.js/emit_asmjs.js b/test/binaryen.js/emit_asmjs.js
index 751712592..e7b9afee2 100644
--- a/test/binaryen.js/emit_asmjs.js
+++ b/test/binaryen.js/emit_asmjs.js
@@ -1,17 +1,9 @@
-function assert(x) {
- if (!x) throw 'error!';
-}
+var module = new binaryen.Module();
-function test() {
- var module = new Binaryen.Module();
+module.addFunction("main", binaryen.i32, binaryen.i32, [], module.local.get(0, binaryen.i32));
- module.addFunction("main", Binaryen.i32, Binaryen.i32, [], module.local.get(0, Binaryen.i32));
+module.addFunctionExport("main", "main");
- module.addFunctionExport("main", "main");
+assert(module.validate()); // should validate before calling emitAsmjs
- assert(module.validate()); // should validate before calling emitAsmjs
-
- console.log(module.emitAsmjs());
-}
-
-Binaryen.ready.then(test);
+console.log(module.emitAsmjs());