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

Method Exec

interpreter/interpretable.go:527–558  ·  view source on GitHub ↗

Exec implements the InterpretableV2 interface method.

(frame *ExecutionFrame)

Source from the content-addressed store, hash-verified

525
526// Exec implements the InterpretableV2 interface method.
527func (ne *evalNe) Exec(frame *ExecutionFrame) ref.Val {
528 lVal := ne.lhs.Exec(frame)
529 if isError(lVal) {
530 // To preserve legacy cost tracking behavior for !=,
531 // track this cost, but it will be removed in the future.
532 if costs := frame.CostTracker(); costs != nil {
533 costs.EvalBinary(frame, ne.id, ne, lVal, types.UnknownType, lVal)
534 }
535 return lVal
536 }
537 rVal := ne.rhs.Exec(frame)
538 if isError(rVal) {
539 // To preserve legacy cost tracking behavior for !=,
540 // track this cost, but it will be removed in the future.
541 if costs := frame.CostTracker(); costs != nil {
542 costs.EvalBinary(frame, ne.id, ne, lVal, rVal, rVal)
543 }
544 return rVal
545 }
546 if isUnknown(lVal) || isUnknown(rVal) {
547 unk := mergeBinaryUnknowns(lVal, rVal)
548 if costs := frame.CostTracker(); costs != nil {
549 costs.EvalBinary(frame, ne.id, ne, lVal, rVal, unk)
550 }
551 return unk
552 }
553 res := types.Bool(types.Equal(lVal, rVal) != types.True)
554 if costs := frame.CostTracker(); costs != nil {
555 costs.EvalBinary(frame, ne.id, ne, lVal, rVal, res)
556 }
557 return res
558}
559
560// Eval implements the Interpretable interface method.
561func (ne *evalNe) Eval(ctx Activation) ref.Val {

Callers

nothing calls this directly

Calls 8

BoolTypeAlias · 0.92
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