From 37b7d32485898c51b77c3ed654dca4e6aeb4c401 Mon Sep 17 00:00:00 2001 From: Eric Joldasov Date: Tue, 13 Dec 2022 18:42:58 +0600 Subject: [PATCH] sysjs: use null and undefined in enums Signed-off-by: Eric Joldasov --- libs/sysjs/src/main.zig | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/sysjs/src/main.zig b/libs/sysjs/src/main.zig index 86470e96..e5340344 100644 --- a/libs/sysjs/src/main.zig +++ b/libs/sysjs/src/main.zig @@ -39,8 +39,8 @@ pub const Value = extern struct { num, bool, str, - nulled, - undef, + null, + undefined, func, }; @@ -54,7 +54,7 @@ pub const Value = extern struct { .bool => bool, .str => String, .func => Function, - .nulled, .undef => @compileError("Cannot get null or undefined as a value"), + .null, .undefined => @compileError("Cannot get null or undefined as a value"), } { return switch (tag) { .object => Object{ .ref = val.val.ref }, @@ -92,8 +92,8 @@ pub const Value = extern struct { .bool => try writer.writeAll(if (val.view(.bool)) "true" else "false"), .str => try writer.print("String@{}({})", .{ val.val.ref, val.view(.str).getLength() }), .func => try writer.print("Function@{}({})", .{ val.val.ref, val.view(.func).paramCount() }), - .nulled => try writer.writeAll("null"), - .undef => try writer.writeAll("undefined"), + .null => try writer.writeAll("null"), + .undefined => try writer.writeAll("undefined"), } } }; @@ -237,11 +237,11 @@ pub fn createBool(val: bool) Value { } pub fn createNull() Value { - return .{ .tag = .nulled, .val = undefined }; + return .{ .tag = .null, .val = undefined }; } pub fn createUndefined() Value { - return .{ .tag = .undef, .val = undefined }; + return .{ .tag = .undefined, .val = undefined }; } const FunType = *const fn (args: Object, args_len: u32, captures: []Value) Value;