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

Method Exec

interpreter/interpretable.go:342–372  ·  view source on GitHub ↗

Exec implements the InterpretableV2 interface method.

(frame *ExecutionFrame)

Source from the content-addressed store, hash-verified

340
341// Exec implements the InterpretableV2 interface method.
342func (or *evalOr) Exec(frame *ExecutionFrame) ref.Val {
343 var err ref.Val = nil
344 var unk *types.Unknown
345 for _, term := range or.terms {
346 val := term.Exec(frame)
347 boolVal, ok := val.(types.Bool)
348 // short-circuit on true.
349 if ok && boolVal == types.True {
350 return types.True
351 }
352 if !ok {
353 isUnk := false
354 unk, isUnk = types.MaybeMergeUnknowns(val, unk)
355 if !isUnk && err == nil {
356 if types.IsError(val) {
357 err = val
358 } else {
359 err = types.MaybeNoSuchOverloadErr(val)
360 }
361 err = types.LabelErrNode(or.id, err)
362 }
363 }
364 }
365 if unk != nil {
366 return unk
367 }
368 if err != nil {
369 return err
370 }
371 return types.False
372}
373
374// Eval implements the Interpretable interface method.
375func (or *evalOr) Eval(ctx Activation) ref.Val {

Callers 1

EvalMethod · 0.95

Calls 5

MaybeMergeUnknownsFunction · 0.92
IsErrorFunction · 0.92
MaybeNoSuchOverloadErrFunction · 0.92
LabelErrNodeFunction · 0.92
ExecMethod · 0.65

Tested by

no test coverage detected