Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/runtime/js.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,13 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
return @constCast(@as(*const T, &.{}));
}

// if it isn't an empty struct, then the v8.Object should have an
// InternalFieldCount > 0, since our toa pointer should be embedded
// at index 0 of the internal field count.
if (js_obj.internalFieldCount() == 0) {
return error.InvalidArgument;
}

const type_name = @typeName(T);
if (@hasField(TypeLookup, type_name) == false) {
@compileError(std.fmt.comptimePrint(
Expand Down
Loading