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

Function EvalBool

runtime/sam/expr/eval.go:66–72  ·  view source on GitHub ↗

EvalBool evaluates e with this and returns the result if it is a bool or error. Otherwise, EvalBool returns an error.

(sctx *super.Context, this super.Value, e Evaluator)

Source from the content-addressed store, hash-verified

64// EvalBool evaluates e with this and returns the result if it is a bool or error.
65// Otherwise, EvalBool returns an error.
66func EvalBool(sctx *super.Context, this super.Value, e Evaluator) super.Value {
67 val := e.Eval(this)
68 if super.TypeUnder(val.Type()) == super.TypeBool || val.IsNull() || val.IsError() {
69 return val
70 }
71 return sctx.WrapError("not type bool", val)
72}
73
74func (a *And) Eval(this super.Value) super.Value {
75 lhs := EvalBool(a.sctx, this, a.lhs)

Callers 5

filterFunction · 0.92
EvalMethod · 0.85
EvalMethod · 0.85
EvalMethod · 0.85
ApplyMethod · 0.85

Calls 6

TypeUnderFunction · 0.92
IsNullMethod · 0.80
IsErrorMethod · 0.80
WrapErrorMethod · 0.80
EvalMethod · 0.65
TypeMethod · 0.65

Tested by

no test coverage detected