mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 07:31:47 +00:00
node subtypes
This commit is contained in:
@@ -96,6 +96,7 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
|
||||
@compileError(std.fmt.comptimePrint("Prototype '{s}' for type '{s} must be a pointer", .{ @typeName(Struct.prototype), @typeName(Struct) }));
|
||||
}
|
||||
|
||||
@setEvalBranchQuota(40_000); // The number of branches increases as we get more structs with the subtype field
|
||||
const subtype: ?SubType =
|
||||
if (@hasDecl(Struct, "subtype")) std.meta.stringToEnum(SubType, Struct.subtype) else null;
|
||||
|
||||
@@ -709,6 +710,8 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
|
||||
if (un.tag_type) |UnionTagType| {
|
||||
inline for (un.fields) |field| {
|
||||
if (value == @field(UnionTagType, field.name)) {
|
||||
const tname = @typeName(@TypeOf(value));
|
||||
_ = tname;
|
||||
return zigValueToJs(templates, isolate, context, @field(value, field.name));
|
||||
}
|
||||
}
|
||||
@@ -908,6 +911,8 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
|
||||
// we have a v8.Context, we can get the executor.
|
||||
fn mapZigInstanceToJs(context: v8.Context, js_obj_or_template: anytype, value: anytype) !PersistentObject {
|
||||
const executor: *Executor = @ptrFromInt(context.getEmbedderData(1).castTo(v8.BigInt).getUint64());
|
||||
const tname = @typeName(@TypeOf(value));
|
||||
_ = tname;
|
||||
return executor._mapZigInstanceToJs(js_obj_or_template, value);
|
||||
}
|
||||
|
||||
@@ -961,6 +966,8 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
|
||||
const isolate = self.isolate;
|
||||
|
||||
if (isEmpty(ptr.child) == false) {
|
||||
const tname = @typeName(T);
|
||||
_ = tname;
|
||||
// The TAO contains the pointer ot our Zig instance as
|
||||
// well as any meta data we'll need to use it later.
|
||||
// See the TaggedAnyOpaque struct for more details.
|
||||
|
||||
Reference in New Issue
Block a user