(args []super.Value)
| 25 | } |
| 26 | |
| 27 | func (u *UDF) Call(args []super.Value) super.Value { |
| 28 | u.stackDepth++ |
| 29 | if u.stackDepth > MaxStackDepth { |
| 30 | return u.sctx.NewErrorf("stack overflow in function %q", u.name) |
| 31 | } |
| 32 | defer func() { u.stackDepth-- }() |
| 33 | if len(args) == 0 { |
| 34 | return u.Body.Eval(super.Null) |
| 35 | } |
| 36 | u.builder.Reset() |
| 37 | for i, a := range args { |
| 38 | u.fields[i].Type = a.Type() |
| 39 | u.builder.Append(a.Bytes()) |
| 40 | } |
| 41 | typ := u.sctx.MustLookupTypeRecord(u.fields) |
| 42 | return u.Body.Eval(super.NewValue(typ, u.builder.Bytes())) |
| 43 | } |