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

Function getValidObjectValue

class_reflect.go:300–312  ·  view source on GitHub ↗

============================================================================= OPTIMIZED HELPER FUNCTIONS ============================================================================= getValidObjectValue extracts and validates object value from JavaScript instance

(ctx *Context, this *Value)

Source from the content-addressed store, hash-verified

298
299// getValidObjectValue extracts and validates object value from JavaScript instance
300func getValidObjectValue(ctx *Context, this *Value) (reflect.Value, error) {
301 obj, err := this.GetGoObject()
302 if err != nil {
303 return reflect.Value{}, fmt.Errorf("failed to get instance data: %w", err)
304 }
305
306 objValue := reflect.ValueOf(obj)
307 if objValue.Kind() == reflect.Ptr {
308 objValue = objValue.Elem()
309 }
310
311 return objValue, nil
312}
313
314// shouldSkipMethod determines if a method should be skipped during binding
315func shouldSkipMethod(method reflect.Method, opts *ReflectOptions) bool {

Callers 3

createMethodWrapperFunction · 0.85
createFieldGetterFunction · 0.85
createFieldSetterFunction · 0.85

Calls 1

GetGoObjectMethod · 0.80

Tested by

no test coverage detected