lang: funcs: wrapped: Simplify the implementation

This commit is contained in:
James Shubin
2025-03-17 02:27:27 -04:00
parent c5d7fdb0a3
commit d4a24d4c9d

View File

@@ -141,16 +141,15 @@ func (obj *Func) Stream(ctx context.Context) error {
obj.last = input // store for next obj.last = input // store for next
} }
values := []types.Value{} args, err := interfaces.StructToCallableArgs(input) // []types.Value, error)
for _, name := range obj.Fn.Type().Ord { if err != nil {
x := input.Struct()[name] return err
values = append(values, x)
} }
if obj.init.Debug { if obj.init.Debug {
obj.init.Logf("Calling function with: %+v", values) obj.init.Logf("Calling function with: %+v", args)
} }
result, err := obj.Call(ctx, values) // (Value, error) result, err := obj.Call(ctx, args) // (Value, error)
if err != nil { if err != nil {
if obj.init.Debug { if obj.init.Debug {
obj.init.Logf("Function returned error: %+v", err) obj.init.Logf("Function returned error: %+v", err)