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

Method Exec

interpreter/interpretable.go:462–493  ·  view source on GitHub ↗

Exec implements the InterpretableV2 interface method.

(frame *ExecutionFrame)

Source from the content-addressed store, hash-verified

460
461// Exec implements the InterpretableV2 interface method.
462func (eq *evalEq) Exec(frame *ExecutionFrame) ref.Val {
463 lVal := eq.lhs.Exec(frame)
464 if isError(lVal) {
465 // To preserve legacy cost tracking behavior for ==
466 // track this cost, but it will be removed in the future.
467 if costs := frame.CostTracker(); costs != nil {
468 costs.EvalBinary(frame, eq.id, eq, lVal, types.UnknownType, lVal)
469 }
470 return lVal
471 }
472 rVal := eq.rhs.Exec(frame)
473 if isError(rVal) {
474 // To preserve legacy cost tracking behavior for ==,
475 // track this cost, but it will be removed in the future.
476 if costs := frame.CostTracker(); costs != nil {
477 costs.EvalBinary(frame, eq.id, eq, lVal, rVal, rVal)
478 }
479 return rVal
480 }
481 if isUnknown(lVal) || isUnknown(rVal) {
482 unk := mergeBinaryUnknowns(lVal, rVal)
483 if costs := frame.CostTracker(); costs != nil {
484 costs.EvalBinary(frame, eq.id, eq, lVal, rVal, unk)
485 }
486 return unk
487 }
488 res := types.Equal(lVal, rVal)
489 if costs := frame.CostTracker(); costs != nil {
490 costs.EvalBinary(frame, eq.id, eq, lVal, rVal, res)
491 }
492 return res
493}
494
495// Eval implements the Interpretable interface method.
496func (eq *evalEq) Eval(ctx Activation) ref.Val {

Callers

nothing calls this directly

Calls 7

EqualFunction · 0.92
isUnknownFunction · 0.85
mergeBinaryUnknownsFunction · 0.85
CostTrackerMethod · 0.80
EvalBinaryMethod · 0.80
isErrorFunction · 0.70
ExecMethod · 0.65

Tested by

no test coverage detected