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

Method Exec

interpreter/interpretable.go:876–898  ·  view source on GitHub ↗

Exec implements the InterpretableV2 interface method.

(frame *ExecutionFrame)

Source from the content-addressed store, hash-verified

874
875// Exec implements the InterpretableV2 interface method.
876func (o *evalObj) Exec(frame *ExecutionFrame) ref.Val {
877 fieldVals := make(map[string]ref.Val, len(o.fields))
878 // If any argument is unknown or error early terminate.
879 for i, field := range o.fields {
880 val := o.vals[i].Exec(frame)
881 if types.IsUnknownOrError(val) {
882 return val
883 }
884 if o.hasOptionals && o.optionals[i] {
885 optVal, ok := val.(*types.Optional)
886 if !ok {
887 return types.LabelErrNode(o.id, invalidOptionalEntryInit(field, val))
888 }
889 if !optVal.HasValue() {
890 delete(fieldVals, field)
891 continue
892 }
893 val = optVal.GetValue()
894 }
895 fieldVals[field] = val
896 }
897 return types.LabelErrNode(o.id, o.provider.NewValue(o.typeName, fieldVals))
898}
899
900// Eval implements the Interpretable interface method.
901func (o *evalObj) Eval(ctx Activation) ref.Val {

Callers 1

EvalMethod · 0.95

Calls 7

IsUnknownOrErrorFunction · 0.92
LabelErrNodeFunction · 0.92
invalidOptionalEntryInitFunction · 0.85
HasValueMethod · 0.80
GetValueMethod · 0.80
ExecMethod · 0.65
NewValueMethod · 0.65

Tested by

no test coverage detected