mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 09:35:59 -04:00
Merge pull request #2379 from lightpanda-io/setter_and_static_arity
Give setters an arity of 1
This commit is contained in:
@@ -651,6 +651,7 @@ fn attachClass(comptime JsApi: type, isolate: *v8.Isolate, template: *const v8.F
|
||||
const cb = v8.v8__FunctionTemplate__New__Config(isolate, &.{
|
||||
.callback = setter,
|
||||
.signature = getter_signature,
|
||||
.length = 1,
|
||||
}).?;
|
||||
const setter_name_str = "set " ++ name;
|
||||
const setter_name_v8 = v8.v8__String__NewFromUtf8(isolate, setter_name_str.ptr, v8.kNormal, @intCast(setter_name_str.len));
|
||||
|
||||
@@ -153,7 +153,9 @@ pub const Function = struct {
|
||||
.cache = opts.cache,
|
||||
.static = opts.static,
|
||||
.wpt_only = opts.wpt_only,
|
||||
.arity = getArity(@TypeOf(func), 1),
|
||||
// Non-static methods receive `self` as their first param; static
|
||||
// methods don't, so don't skip the first param for them.
|
||||
.arity = getArity(@TypeOf(func), if (opts.static) 0 else 1),
|
||||
.func = if (opts.noop) noopFunction else struct {
|
||||
fn wrap(handle: ?*const v8.FunctionCallbackInfo) callconv(.c) void {
|
||||
Caller.Function.call(T, handle.?, func, opts);
|
||||
|
||||
Reference in New Issue
Block a user