MCPcopy Create free account
hub / github.com/cel-expr/cel-go / Exec

Method Exec

interpreter/interpretable.go:254–269  ·  view source on GitHub ↗

Exec implements the InterpretableV2 interface method.

(frame *ExecutionFrame)

Source from the content-addressed store, hash-verified

252
253// Exec implements the InterpretableV2 interface method.
254func (test *evalTestOnly) Exec(frame *ExecutionFrame) ref.Val {
255 val, err := test.Resolve(frame)
256 var res ref.Val
257 // Return an error if the resolve step fails
258 if err != nil {
259 res = types.LabelErrNode(test.id, types.WrapErr(err))
260 } else if optVal, isOpt := val.(*types.Optional); isOpt {
261 res = types.Bool(optVal.HasValue())
262 } else {
263 res = test.Adapter().NativeToValue(val)
264 }
265 if costs := frame.CostTracker(); costs != nil {
266 costs.EvalAttribute(test.id, true, res)
267 }
268 return res
269}
270
271// Eval implements the Interpretable interface method.
272func (test *evalTestOnly) Eval(ctx Activation) ref.Val {

Callers

nothing calls this directly

Calls 9

LabelErrNodeFunction · 0.92
WrapErrFunction · 0.92
BoolTypeAlias · 0.92
HasValueMethod · 0.80
CostTrackerMethod · 0.80
EvalAttributeMethod · 0.80
ResolveMethod · 0.65
NativeToValueMethod · 0.65
AdapterMethod · 0.65

Tested by

no test coverage detected