File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 1+ import assert from "assert" ;
12import wabt from "wabt" ;
23import { Parser } from "../parser" ;
34import { Tokenizer } from "../tokenizer" ;
@@ -19,7 +20,7 @@ export async function compileToWasmAndRun(code: string) {
1920 const wat = watGenerator . visit ( watIR ) ;
2021
2122 const w = await wabt ( ) ;
22- const wasm : Uint8Array = w . parseWat ( "a" , wat ) . toBinary ( { } ) . buffer ;
23+ const wasm = w . parseWat ( "a" , wat ) . toBinary ( { } ) . buffer as BufferSource ;
2324
2425 const memory = new WebAssembly . Memory ( { initial : 1 } ) ;
2526
@@ -54,5 +55,6 @@ export async function compileToWasmAndRun(code: string) {
5455 } ) ;
5556
5657 // run the exported main function
57- return ( result as any ) . instance . exports . main ( ) as [ number , number ] ;
58+ assert ( typeof result . instance . exports . main === "function" ) ;
59+ return result . instance . exports . main ( ) as [ number , number ] ;
5860}
You can’t perform that action at this time.
0 commit comments