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

Method Eval

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

Source from the content-addressed store, hash-verified

72}
73
74func (a *And) Eval(this super.Value) super.Value {
75 lhs := EvalBool(a.sctx, this, a.lhs)
76 rhs := EvalBool(a.sctx, this, a.rhs)
77 if isfalse(lhs) || isfalse(rhs) {
78 // anything AND FALSE = FALSE
79 return super.False
80 }
81 // ERROR AND NULL = ERROR
82 // ERROR AND TRUE = ERROR
83 if lhs.IsError() {
84 return lhs
85 }
86 if rhs.IsError() {
87 return rhs
88 }
89 if lhs.IsNull() || rhs.IsNull() {
90 // NULL AND TRUE = NULL
91 return super.Null
92 }
93 return super.True
94}
95
96func isfalse(val super.Value) bool {
97 return val.Type().ID() == super.IDBool && !val.IsNull() && !val.Bool()

Callers

nothing calls this directly

Calls 4

EvalBoolFunction · 0.85
isfalseFunction · 0.85
IsErrorMethod · 0.80
IsNullMethod · 0.80

Tested by

no test coverage detected