Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 682
Description

-1
In the capture image,main.ts is a assemblyscript
assembly/main.ts (assemblyscript)
declarefunctionsayHello(): void;sayHello()exportfunctionadd(x: i32,y: i32): i32{returnx+y;}exportfunctiongetTypeOf():string{letx:i32=12;returntypeofx;}exportfunctionteste(): string{letx="ZZZZZZZZZZZZ"returnx;}but the code
export function getTypeOf():string{let x:i32 = 12; return typeof x} src/main.js
(async()=>{let buffer = await fetch("../out/main.wasm"); let arrayBuffer = await buffer.arrayBuffer(); let lib = instantiateBuffer(arrayBuffer,{main:{sayHello(){console.log("Hello from WebAssembly!")} }, env:{abort(_msg, _file, line, column){console.error("abort called at main.ts:" + line + ":" + column)} }, }); document.getElementById("container").textContent = "Result: " + lib.add(19, 23) + " Type:" + lib.__getString(lib.getTypeOf()) + " teste:" + lib.__getString(lib.teste()) })(); lib.getTypeOf() return a ptr of a string,so I use lib.__getString(ptr) to convert ptr to string.but a value is "number",not the "i32"
### Issue: The Expected value of This Function is "i32",but actuality the result is "number"

I added a assemblyscript loader by download from 「 https://raw.githubusercontent.com/AssemblyScript/assemblyscript/master/lib/loader/index.js 」,and rename the to loader.js and put the file to folder src.
### In assemblyscript,we have i32 A 32-bit signed integer,if we load this wasm ,so we can check the type of i32?If cannot check i32 by assemblyscript,is there another way to check the value of wasm ?
wasm-project201910070050.zip
PS:
This days ,I found the https://github.com/AssemblyScript/assemblyscript/tree/master/lib/parse
,but I don`t know the detail about the parse,is this parse can check type the type of i32?