MCPcopy Create free account
hub / github.com/brimdata/super / evalAndPromote

Method evalAndPromote

runtime/sam/expr/eval.go:245–259  ·  view source on GitHub ↗
(this super.Value)

Source from the content-addressed store, hash-verified

243}
244
245func (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
261func (n *numeric) eval(this super.Value) (super.Value, super.Value, *super.Value) {
262 lhs := n.lhs.Eval(this).Under()

Callers 5

EvalMethod · 0.80
EvalMethod · 0.80
EvalMethod · 0.80
EvalMethod · 0.80
EvalMethod · 0.80

Calls 5

evalMethod · 0.95
PromoteFunction · 0.92
PtrMethod · 0.80
NewErrorMethod · 0.80
LookupTypeMethod · 0.65

Tested by

no test coverage detected