Skip to content

Commit 3a49ee8

Browse files
committed
Improve prototype resolution for native types
Prototype resolution of Zig types previously had 2 limitations (bug?). The first was that the Zig prototype chain could only be 1 deep. You couldn't do A->B->C where each of those was a Zig type (but you could do A->B->C->D->E ... so long as every other type was a C opaque value). The other limitation was that Zig prototypes only worked when the nested field was directly embedded in the struct (i.e. not a pointer). So you could do: ```zig const X = struct { proto: XParent, }; ``` But not: ```zig const X = struct { proto: *XParent, }; ``` This addresses both limitations. The first issue is solved by keeping track of the cumulative offset
1 parent 2a5c7d1 commit 3a49ee8

File tree

3 files changed

+308
-122
lines changed

3 files changed

+308
-122
lines changed

src/browser/dom/performance.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ test "Performance: get_timeOrigin" {
162162
try testing.expect(time_origin >= 0);
163163

164164
// Check resolution
165-
try testing.expectDelta(@rem(time_origin * std.time.us_per_ms, 100.0), 0.0, 0.1);
165+
try testing.expectDelta(@rem(time_origin * std.time.us_per_ms, 100.0), 0.0, 0.2);
166166
}
167167

168168
test "Performance: now" {

0 commit comments

Comments
 (0)