Compare commits

...

3 Commits

Author SHA1 Message Date
Meghan Denny
5ba2d4bd30 Merge branch 'main' into nektro-patch-60725 2024-08-01 18:43:46 -07:00
Meghan Denny
f82d37355f Merge branch 'main' into nektro-patch-60725 2024-08-01 17:46:34 -07:00
Meghan Denny
9a7370c7e7 bindings: init Arguments members to .undefined instead of .zero 2024-07-26 02:12:12 -07:00

View File

@@ -6030,16 +6030,13 @@ pub const CallFrame = opaque {
fn Arguments(comptime max: usize) type {
return struct {
ptr: [max]JSC.JSValue,
len: usize,
ptr: [max]JSC.JSValue = .{.undefined} ** max,
len: usize = 0,
pub inline fn init(comptime i: usize, ptr: [*]const JSC.JSValue) @This() {
var args: [max]JSC.JSValue = std.mem.zeroes([max]JSC.JSValue);
args[0..comptime i].* = ptr[0..i].*;
return @This(){
.ptr = args,
.len = i,
};
var args: @This() = .{};
args.ptr[0..comptime i].* = ptr[0..i].*;
args.len = i;
return args;
}
pub inline fn slice(self: *const @This()) []const JSValue {
@@ -6052,7 +6049,7 @@ pub const CallFrame = opaque {
const len = self.argumentsCount();
const ptr = self.argumentsPtr();
return switch (@as(u4, @min(len, max))) {
0 => .{ .ptr = undefined, .len = 0 },
0 => .{},
inline 1...9 => |count| Arguments(max).init(comptime @min(count, max), ptr),
else => unreachable,
};