update zig-v8 dep for proper named property masking flag

This commit is contained in:
Karl Seguin
2025-05-07 20:12:59 +08:00
parent 35b2ea870d
commit b542762dce

View File

@@ -45,18 +45,18 @@ pub const MyObject = struct {
}; };
} }
// pub fn named_get(_: *const MyObject, name: []const u8, has_value: *bool) ?OtherUnion { pub fn named_get(_: *const MyObject, name: []const u8, has_value: *bool) ?OtherUnion {
// if (std.mem.eql(u8, name, "a")) { if (std.mem.eql(u8, name, "a")) {
// has_value.* = true; has_value.* = true;
// return .{ .Other = .{ .val = 4 } }; return .{ .Other = .{ .val = 4 } };
// } }
// if (std.mem.eql(u8, name, "c")) { if (std.mem.eql(u8, name, "c")) {
// has_value.* = true; has_value.* = true;
// return .{ .Bool = true }; return .{ .Bool = true };
// } }
// has_value.* = false; has_value.* = false;
// return null; return null;
// } }
pub fn get_val(self: *const MyObject) bool { pub fn get_val(self: *const MyObject) bool {
return self.val; return self.val;
@@ -95,31 +95,29 @@ test "JS: object types" {
defer runner.deinit(); defer runner.deinit();
// v8 has 5 default "own" properties // v8 has 5 default "own" properties
const own_base = "5";
// TODO: v8 upgrade try runner.testCases(&.{
// const own_base = "5"; .{ "Object.getOwnPropertyNames(MyObject).length;", own_base },
.{ "let myObj = new MyObject(true);", "undefined" },
// check object property
.{ "myObj.a.val()", "4" },
.{ "myObj.b", "undefined" },
.{ "Object.getOwnPropertyNames(myObj).length;", "0" },
// try runner.testCases(&.{ // check if setter (pointer) still works
// .{ "Object.getOwnPropertyNames(MyObject).length;", own_base }, .{ "myObj.val", "true" },
// .{ "let myObj = new MyObject(true);", "undefined" }, .{ "myObj.val = false", "false" },
// // check object property .{ "myObj.val", "false" },
// .{ "myObj.a.val()", "4" },
// .{ "myObj.b", "undefined" },
// .{ "Object.getOwnPropertyNames(myObj).length;", "0" },
// // check if setter (pointer) still works .{ "let myObj2 = new MyObject(false);", "undefined" },
// .{ "myObj.val", "true" }, .{ "myObj2.c", "true" },
// .{ "myObj.val = false", "false" }, }, .{});
// .{ "myObj.val", "false" },
// .{ "let myObj2 = new MyObject(false);", "undefined" }, try runner.testCases(&.{
// .{ "myObj2.c", "true" }, .{ "let myAPI = new MyAPI();", "undefined" },
// }, .{}); .{ "let myObjIndirect = myAPI.obj();", "undefined" },
// check object property
// try runner.testCases(&.{ .{ "myObjIndirect.a.val()", "4" },
// .{ "let myAPI = new MyAPI();", "undefined" }, }, .{});
// .{ "let myObjIndirect = myAPI.obj();", "undefined" },
// // check object property
// .{ "myObjIndirect.a.val()", "4" },
// }, .{});
} }