-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path0.js
More file actions
22 lines (19 loc) · 684 Bytes
/
Copy path0.js
File metadata and controls
22 lines (19 loc) · 684 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const fs = require('fs');
const wabt = require('wabt')();
async function main() {
const src = '0.wat';
const wasm = wabt.parseWat(src, fs.readFileSync(src, 'utf8'));
const {buffer} = wasm.toBinary({});
const {instance} = await WebAssembly.instantiate(buffer);
const {exports: e} = instance;
console.log('f01_const', e.f01_const());
// console.log('f02_params', e.f02_params(1, 2));
// console.log('f03_params_named', e.f03_params_named(1, 2));
// console.log('f04_folded', e.f04_folded(1, 2));
// console.log('f05_nested', e.f05_nested(1, 2));
// console.log('f06_locals', e.f06_locals(1, 2));
}
main().catch(e => {
console.error(e);
process.exit(1);
});