|
|
|
@ -2,7 +2,6 @@ const std = @import("std"); |
|
|
|
|
const expect = std.testing.expect; |
|
|
|
|
|
|
|
|
|
const Func = @import("./func.zig").Func; |
|
|
|
|
const Extern = @import("./extern.zig").Extern; |
|
|
|
|
const Vec = @import("./vec.zig").Vec; |
|
|
|
|
|
|
|
|
|
/// A host-defined un-forgeable reference to pass into WebAssembly. |
|
|
|
@ -144,8 +143,9 @@ pub const Val = extern struct { |
|
|
|
|
|
|
|
|
|
extern "c" fn wasmtime_val_copy(*Val, *const Val) void; |
|
|
|
|
extern "c" fn wasmtime_val_delete(*Val) void; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
test "convert value to Val and back" { |
|
|
|
|
test Val { |
|
|
|
|
var small = Val.fromValue(i32, -12); |
|
|
|
|
defer small.deinit(); |
|
|
|
|
try expect(small.kind == ValKind.i32); |
|
|
|
@ -177,15 +177,7 @@ pub const Val = extern struct { |
|
|
|
|
try expect(no.kind == ValKind.i32); |
|
|
|
|
try expect(no.of.i32 == 0); |
|
|
|
|
try expect(try no.toValue(bool) == false); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// pub const ValVec = Vec(Val, wasm_val_vec_new_empty, wasm_val_vec_new_uninitialized, wasm_val_vec_new, wasm_val_vec_copy, wasm_val_vec_delete); |
|
|
|
|
// extern "c" fn wasm_val_vec_new_empty(*anyopaque, usize) void; |
|
|
|
|
// extern "c" fn wasm_val_vec_new_uninitialized(*anyopaque, usize) void; |
|
|
|
|
// extern "c" fn wasm_val_vec_new(*anyopaque, usize, [*]const Val) void; |
|
|
|
|
// extern "c" fn wasm_val_vec_copy(*anyopaque, *const anyopaque) void; |
|
|
|
|
// extern "c" fn wasm_val_vec_delete(*anyopaque) void; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// An object representing the type of a value. |
|
|
|
|
pub const ValType = opaque { |
|
|
|
|