aboutsummaryrefslogtreecommitdiff
path: root/src/zilch/Env/value.zig
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-10-15 21:57:59 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2026-10-15 21:57:59 +0200
commitdd24e86dad0402917b1713d1afeefaf65c3d1e51 (patch)
tree7f6c9f4d23eb8e60b6b7374233f33423cff40708 /src/zilch/Env/value.zig
parenta1dc55be6e695a1c04e5e9e0f1ce7406a5dd3dff (diff)
zilch: reusing results in processing loop
Diffstat (limited to 'src/zilch/Env/value.zig')
-rw-r--r--src/zilch/Env/value.zig10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/zilch/Env/value.zig b/src/zilch/Env/value.zig
index 59b788f..cedaa89 100644
--- a/src/zilch/Env/value.zig
+++ b/src/zilch/Env/value.zig
@@ -1,5 +1,6 @@
const std = @import("std");
const Object = @import("../Object.zig");
+const AnyFuture = @import("future.zig").AnyFuture;
pub fn isString(comptime T: type) bool {
return comptime blk: {
@@ -37,6 +38,7 @@ pub const Value = extern struct {
uint: usize,
float: f64,
undefined: void,
+ future: usize,
},
pub fn from(value: anytype) Value {
@@ -70,6 +72,10 @@ pub const Value = extern struct {
.kind = .undefined,
.value = .{ .undefined = {} },
},
+ AnyFuture => .{
+ .kind = .future,
+ .value = .{ .future = value.unresolved.id },
+ },
else => str: {
if (comptime isString(T)) {
break :str .{
@@ -92,13 +98,13 @@ pub const Value = extern struct {
}
pub const Kind = enum(u8) {
- uninit = 0,
object = 1,
string = 2,
int = 3,
uint = 4,
float = 5,
undefined = 6,
+ future = 7,
pub fn asType(comptime self: Kind) type {
return switch (self) {
@@ -108,7 +114,7 @@ pub const Value = extern struct {
.uint => return usize,
.float => f64,
.undefined => return void,
- .uninit => @compileError("uninit has no associated type."),
+ .future => AnyFuture,
};
}
};