@@ -1342,14 +1342,15 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
13421342 }
13431343 const configuration = v8.IndexedPropertyHandlerConfiguration {
13441344 .getter = struct {
1345- fn callback (idx : u32 , raw_info : ? * const v8.C_PropertyCallbackInfo ) callconv (.c ) void {
1345+ fn callback (idx : u32 , raw_info : ? * const v8.C_PropertyCallbackInfo ) callconv (.c ) u8 {
13461346 const info = v8 .PropertyCallbackInfo .initFromV8 (raw_info );
13471347 var caller = Caller (Self , State ).init (info );
13481348 defer caller .deinit ();
13491349
13501350 const named_function = comptime NamedFunction .init (Struct , "indexed_get" );
1351- caller .getIndex (Struct , named_function , idx , info ) catch | err | {
1351+ return caller .getIndex (Struct , named_function , idx , info ) catch | err | blk : {
13521352 caller .handleError (Struct , named_function , err , info );
1353+ break :blk v8 .Intercepted .No ;
13531354 };
13541355 }
13551356 }.callback ,
@@ -1371,14 +1372,15 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
13711372 }
13721373 const configuration = v8.NamedPropertyHandlerConfiguration {
13731374 .getter = struct {
1374- fn callback (c_name : ? * const v8.C_Name , raw_info : ? * const v8.C_PropertyCallbackInfo ) callconv (.c ) void {
1375+ fn callback (c_name : ? * const v8.C_Name , raw_info : ? * const v8.C_PropertyCallbackInfo ) callconv (.c ) u8 {
13751376 const info = v8 .PropertyCallbackInfo .initFromV8 (raw_info );
13761377 var caller = Caller (Self , State ).init (info );
13771378 defer caller .deinit ();
13781379
13791380 const named_function = comptime NamedFunction .init (Struct , "named_get" );
1380- caller .getNamedIndex (Struct , named_function , .{ .handle = c_name .? }, info ) catch | err | {
1381+ return caller .getNamedIndex (Struct , named_function , .{ .handle = c_name .? }, info ) catch | err | blk : {
13811382 caller .handleError (Struct , named_function , err , info );
1383+ break :blk v8 .Intercepted .No ;
13821384 };
13831385 }
13841386 }.callback ,
@@ -1812,7 +1814,7 @@ fn Caller(comptime E: type, comptime State: type) type {
18121814 _ = @call (.auto , func , args );
18131815 }
18141816
1815- fn getIndex (self : * Self , comptime Struct : type , comptime named_function : NamedFunction , idx : u32 , info : v8.PropertyCallbackInfo ) ! void {
1817+ fn getIndex (self : * Self , comptime Struct : type , comptime named_function : NamedFunction , idx : u32 , info : v8.PropertyCallbackInfo ) ! u8 {
18161818 const func = @field (Struct , named_function .name );
18171819 const IndexedGet = @TypeOf (func );
18181820 if (@typeInfo (IndexedGet ).@"fn" .return_type == null ) {
@@ -1841,15 +1843,13 @@ fn Caller(comptime E: type, comptime State: type) type {
18411843
18421844 const res = @call (.auto , func , args );
18431845 if (has_value == false ) {
1844- // for an indexed parameter, say nodes[10000], we should return
1845- // undefined, not null, if the index is out of rante
1846- info .getReturnValue ().set (try self .zigValueToJs ({}));
1847- } else {
1848- info .getReturnValue ().set (try self .zigValueToJs (res ));
1846+ return v8 .Intercepted .No ;
18491847 }
1848+ info .getReturnValue ().set (try self .zigValueToJs (res ));
1849+ return v8 .Intercepted .Yes ;
18501850 }
18511851
1852- fn getNamedIndex (self : * Self , comptime Struct : type , comptime named_function : NamedFunction , name : v8.Name , info : v8.PropertyCallbackInfo ) ! void {
1852+ fn getNamedIndex (self : * Self , comptime Struct : type , comptime named_function : NamedFunction , name : v8.Name , info : v8.PropertyCallbackInfo ) ! u8 {
18531853 const func = @field (Struct , named_function .name );
18541854 const NamedGet = @TypeOf (func );
18551855 if (@typeInfo (NamedGet ).@"fn" .return_type == null ) {
@@ -1877,12 +1877,10 @@ fn Caller(comptime E: type, comptime State: type) type {
18771877
18781878 const res = @call (.auto , func , args );
18791879 if (has_value == false ) {
1880- // for an indexed parameter, say nodes[10000], we should return
1881- // undefined, not null, if the index is out of rante
1882- info .getReturnValue ().set (try self .zigValueToJs ({}));
1883- } else {
1884- info .getReturnValue ().set (try self .zigValueToJs (res ));
1880+ return v8 .Intercepted .No ;
18851881 }
1882+ info .getReturnValue ().set (try self .zigValueToJs (res ));
1883+ return v8 .Intercepted .Yes ;
18861884 }
18871885
18881886 fn nameToString (self : * Self , name : v8.Name ) ! []const u8 {
0 commit comments