setArgs sets the appropriate [Value] objects for the arguments of the function associated with the function button.
()
| 472 | // setArgs sets the appropriate [Value] objects for the |
| 473 | // arguments of the function associated with the function button. |
| 474 | func (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 |
no test coverage detected