MCPcopy Create free account
hub / github.com/buke/quickjs-go / goClassMethodProxy

Function goClassMethodProxy

callback_dispatch.go:75–95  ·  view source on GitHub ↗

export goClassMethodProxy

(ctx *C.JSContext, thisVal C.JSValueConst,
	argc C.int, argv *C.JSValueConst, magic C.int)

Source from the content-addressed store, hash-verified

73
74//export goClassMethodProxy
75func goClassMethodProxy(ctx *C.JSContext, thisVal C.JSValueConst,
76 argc C.int, argv *C.JSValueConst, magic C.int) C.JSValue {
77
78 goCtx, fn, err := getContextAndObject(ctx, magic, errMethodNotFound)
79 if err != nil {
80 return throwProxyError(ctx, *err)
81 }
82
83 method, ok := fn.(ClassMethodFunc)
84 if !ok {
85 return throwProxyError(ctx, errInvalidMethodType)
86 }
87
88 thisValue := &Value{ctx: goCtx, ref: C.JSValue(thisVal)}
89 args := convertCArgsToGoValues(argc, argv, goCtx)
90 result := method(goCtx, thisValue, args)
91 if result == nil {
92 return C.JS_NewUndefined()
93 }
94 return result.ref
95}
96
97//export goClassGetterProxy
98func goClassGetterProxy(ctx *C.JSContext, thisVal C.JSValueConst, magic C.int) C.JSValue {

Callers 1

GoClassMethodProxyFunction · 0.85

Calls 3

getContextAndObjectFunction · 0.85
throwProxyErrorFunction · 0.85
convertCArgsToGoValuesFunction · 0.85

Tested by

no test coverage detected