Exports wasm.ValueType and makes Functions interfaces for signature verification (#284)

This moves code for `ValueType` constants public, so that we can
centralize discussion on how values are encoded. We'll need this when
re-introducing a Globals API.

To keep complexity down in consideration that there are only 4 types, I
copied the constants into the internalwasm package. This reduces the
import complexity otherwise would have caused.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Co-authored-by: Takaya Saeki <takaya@tetrate.io>
This commit is contained in:
Crypt Keeper
2022-02-24 10:04:15 +08:00
committed by GitHub
parent 80d0c348be
commit 7c92cf4ca3
19 changed files with 203 additions and 151 deletions

View File

@@ -43,7 +43,7 @@ func Test_WASI(t *testing.T) {
// Implement the function pointer. This mainly shows how you can decouple a host function dependency.
randomGet = func(ctx wasm.ModuleContext, buf, bufLen uint32) wasi.Errno {
res, err := randomGetFn(ctx, uint64(buf), uint64(bufLen))
res, err := randomGetFn.Call(ctx, uint64(buf), uint64(bufLen))
require.NoError(t, err)
return wasi.Errno(res[0])
}