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

Function goClassSetterProxy

callback_dispatch.go:118–138  ·  view source on GitHub ↗

export goClassSetterProxy

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

Source from the content-addressed store, hash-verified

116
117//export goClassSetterProxy
118func goClassSetterProxy(ctx *C.JSContext, thisVal C.JSValueConst,
119 val C.JSValueConst, magic C.int) C.JSValue {
120
121 goCtx, fn, err := getContextAndObject(ctx, magic, errSetterNotFound)
122 if err != nil {
123 return throwProxyError(ctx, *err)
124 }
125
126 setter, ok := fn.(ClassSetterFunc)
127 if !ok {
128 return throwProxyError(ctx, errInvalidSetterType)
129 }
130
131 thisValue := &Value{ctx: goCtx, ref: C.JSValue(thisVal)}
132 setValue := &Value{ctx: goCtx, ref: C.JSValue(val)}
133 result := setter(goCtx, thisValue, setValue)
134 if result == nil {
135 return C.JS_NewUndefined()
136 }
137 return result.ref
138}

Callers 1

GoClassSetterProxyFunction · 0.85

Calls 2

getContextAndObjectFunction · 0.85
throwProxyErrorFunction · 0.85

Tested by

no test coverage detected