MCPcopy Create free account
hub / github.com/cogentcore/core / setArgs

Method setArgs

core/funcbutton.go:474–492  ·  view source on GitHub ↗

setArgs sets the appropriate [Value] objects for the arguments of the function associated with the function button.

()

Source from the content-addressed store, hash-verified

472// setArgs sets the appropriate [Value] objects for the
473// arguments of the function associated with the function button.
474func (fb *FuncButton) setArgs() {
475 narg := fb.reflectFunc.Type().NumIn()
476 fb.Args = make([]FuncArg, narg)
477 for i := range fb.Args {
478 typ := fb.reflectFunc.Type().In(i)
479
480 name := ""
481 if fb.typesFunc.Args != nil && len(fb.typesFunc.Args) > i {
482 name = fb.typesFunc.Args[i]
483 } else {
484 name = reflectx.NonPointerType(typ).Name()
485 }
486
487 fb.Args[i] = FuncArg{
488 Name: name,
489 Value: reflect.New(typ).Elem().Interface(),
490 }
491 }
492}
493
494// setReturns sets the appropriate [Value] objects for the
495// return values of the function associated with the function

Callers 1

setFuncImplMethod · 0.95

Calls 7

NonPointerTypeFunction · 0.92
NumInMethod · 0.80
ElemMethod · 0.80
TypeMethod · 0.65
NameMethod · 0.65
NewMethod · 0.65
InMethod · 0.45

Tested by

no test coverage detected