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

Function goClassGetterProxy

callback_dispatch.go:98–115  ·  view source on GitHub ↗

export goClassGetterProxy

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

Source from the content-addressed store, hash-verified

96
97//export goClassGetterProxy
98func goClassGetterProxy(ctx *C.JSContext, thisVal C.JSValueConst, magic C.int) C.JSValue {
99 goCtx, fn, err := getContextAndObject(ctx, magic, errGetterNotFound)
100 if err != nil {
101 return throwProxyError(ctx, *err)
102 }
103
104 getter, ok := fn.(ClassGetterFunc)
105 if !ok {
106 return throwProxyError(ctx, errInvalidGetterType)
107 }
108
109 thisValue := &Value{ctx: goCtx, ref: C.JSValue(thisVal)}
110 result := getter(goCtx, thisValue)
111 if result == nil {
112 return C.JS_NewUndefined()
113 }
114 return result.ref
115}
116
117//export goClassSetterProxy
118func goClassSetterProxy(ctx *C.JSContext, thisVal C.JSValueConst,

Callers 1

GoClassGetterProxyFunction · 0.85

Calls 2

getContextAndObjectFunction · 0.85
throwProxyErrorFunction · 0.85

Tested by

no test coverage detected