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

Function addReflectionMethods

class_reflect.go:253–268  ·  view source on GitHub ↗

addReflectionMethods scans struct methods and adds them to the ClassBuilder Only exported methods are processed due to Go reflection limitations

(builder *ClassBuilder, typ reflect.Type, opts *ReflectOptions)

Source from the content-addressed store, hash-verified

251// addReflectionMethods scans struct methods and adds them to the ClassBuilder
252// Only exported methods are processed due to Go reflection limitations
253func addReflectionMethods(builder *ClassBuilder, typ reflect.Type, opts *ReflectOptions) {
254 // Get pointer type to include pointer receiver methods
255 ptrTyp := reflect.PointerTo(typ)
256
257 for i := 0; i < ptrTyp.NumMethod(); i++ {
258 method := ptrTyp.Method(i)
259
260 if shouldSkipMethod(method, opts) {
261 continue
262 }
263
264 // Create method wrapper and add to builder
265 methodWrapper := createMethodWrapper(method)
266 builder.Method(method.Name, methodWrapper)
267 }
268}
269
270// addReflectionAccessors scans struct fields and adds them as accessors
271// Only exported fields are processed to maintain Go encapsulation principles

Callers 1

buildClassFromReflectionFunction · 0.85

Calls 3

shouldSkipMethodFunction · 0.85
createMethodWrapperFunction · 0.85
MethodMethod · 0.80

Tested by

no test coverage detected