(args []super.Value)
| 67 | } |
| 68 | |
| 69 | func (l *Log) Call(args []super.Value) super.Value { |
| 70 | if args[0].IsError() { |
| 71 | return args[0] |
| 72 | } |
| 73 | if args[0].IsNull() { |
| 74 | return super.Null |
| 75 | } |
| 76 | x, ok := coerce.ToFloat(args[0], super.TypeFloat64) |
| 77 | if !ok { |
| 78 | return l.sctx.WrapError("log: not a number", args[0]) |
| 79 | } |
| 80 | if x <= 0 { |
| 81 | return l.sctx.WrapError("log: illegal argument", args[0]) |
| 82 | } |
| 83 | return super.NewFloat64(math.Log(x)) |
| 84 | } |
| 85 | |
| 86 | type reducer struct { |
| 87 | sctx *super.Context |
nothing calls this directly
no test coverage detected