mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
update zig-v8 dep for proper named property masking flag
This commit is contained in:
@@ -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" },
|
|
||||||
// }, .{});
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user