From 02582cc490fc0d753dd153211cc172eb28fbee5d Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Mon, 5 Oct 2026 15:33:46 +0200 Subject: first sketch of wasm environment --- src/z/Env/value.zig | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/z/Env/value.zig (limited to 'src/z/Env/value.zig') diff --git a/src/z/Env/value.zig b/src/z/Env/value.zig new file mode 100644 index 0000000..4630a76 --- /dev/null +++ b/src/z/Env/value.zig @@ -0,0 +1,36 @@ +pub const Value = extern struct { + kind: Kind, + value: extern union { + object: u32, + string: extern struct { + ptr: [*]const u8, + len: usize, + }, + int: isize, + uint: usize, + float: f64, + undefined: void, + }, + + pub const Kind = enum(u8) { + uninit = 0, + object = 1, + string = 2, + int = 3, + uint = 4, + float = 5, + undefined = 6, + + pub fn asType(comptime self: Kind) type { + return switch (self) { + .object => return u32, + .string => return []const u8, + .int => return isize, + .uint => return usize, + .float => f64, + .undefined => return void, + .uninit => @compileError("uninit has no associated type."), + }; + } + }; +}; -- cgit v1.2.3-70-g09d2