mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
Return TypeError if trying to turn an unknown v8.Object into a toa
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user