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

Function EvalActivation

interpreter/interpretable.go:209–220  ·  view source on GitHub ↗

EvalActivation runs an InterpretableV2 Exec method safely with any Activation, wrapping it in a pooled ExecutionFrame if needed and releasing it after execution.

(ctx Activation, exec func(*ExecutionFrame) ref.Val)

Source from the content-addressed store, hash-verified

207// EvalActivation runs an InterpretableV2 Exec method safely with any Activation,
208// wrapping it in a pooled ExecutionFrame if needed and releasing it after execution.
209func EvalActivation(ctx Activation, exec func(*ExecutionFrame) ref.Val) ref.Val {
210 if f, ok := ctx.(*ExecutionFrame); ok {
211 return exec(f)
212 }
213 f, err := NewExecutionFrame(ctx)
214 if err != nil {
215 return types.NewErr("invalid activation: %v", err)
216 }
217 res := exec(f)
218 f.Close()
219 return res
220}
221
222// findFrame walks the activation hierarchy via Unwrap and Parent to locate an
223// existing ExecutionFrame, if one exists.

Callers 15

EvalMethod · 0.92
EvalMethod · 0.92
EvalMethod · 0.92
EvalMethod · 0.92
EvalMethod · 0.85
EvalMethod · 0.85
EvalMethod · 0.85
EvalMethod · 0.85
EvalMethod · 0.85
EvalMethod · 0.85
EvalMethod · 0.85
EvalMethod · 0.85

Calls 3

CloseMethod · 0.95
NewErrFunction · 0.92
NewExecutionFrameFunction · 0.85

Tested by

no test coverage detected