| 243 | } |
| 244 | |
| 245 | func (n *numeric) evalAndPromote(this super.Value) (super.Value, super.Value, super.Type, *super.Value) { |
| 246 | lhsVal, rhsVal, errVal := n.eval(this) |
| 247 | if errVal != nil { |
| 248 | return super.Null, super.Null, nil, errVal |
| 249 | } |
| 250 | id, err := coerce.Promote(lhsVal, rhsVal) |
| 251 | if err != nil { |
| 252 | return super.Null, super.Null, nil, n.sctx.NewError(err).Ptr() |
| 253 | } |
| 254 | typ, err := n.sctx.LookupType(id) |
| 255 | if err != nil { |
| 256 | return super.Null, super.Null, nil, n.sctx.NewError(err).Ptr() |
| 257 | } |
| 258 | return lhsVal, rhsVal, typ, nil |
| 259 | } |
| 260 | |
| 261 | func (n *numeric) eval(this super.Value) (super.Value, super.Value, *super.Value) { |
| 262 | lhs := n.lhs.Eval(this).Under() |