mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
Merge pull request #549 from lightpanda-io/type_error_on_non_zig_values
Return TypeError if trying to turn an unknown v8.Object into a toa
This commit is contained in:
@@ -1403,6 +1403,13 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
|
|||||||
return @constCast(@as(*const T, &.{}));
|
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);
|
const type_name = @typeName(T);
|
||||||
if (@hasField(TypeLookup, type_name) == false) {
|
if (@hasField(TypeLookup, type_name) == false) {
|
||||||
@compileError(std.fmt.comptimePrint(
|
@compileError(std.fmt.comptimePrint(
|
||||||
|
|||||||
Reference in New Issue
Block a user