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

Method InitState

interpreter/runtimecost.go:72–85  ·  view source on GitHub ↗

InitState produces a CostTracker and bundles it into an Activation in a way which is not visible to expression evaluation.

(frame *ExecutionFrame)

Source from the content-addressed store, hash-verified

70// InitState produces a CostTracker and bundles it into an Activation in a way which is not visible
71// to expression evaluation.
72func (ct *costTrackerFactory) InitState(frame *ExecutionFrame) (any, error) {
73 if frame.ctx != nil && frame.ctx.costs != nil {
74 return frame.ctx.costs, nil
75 }
76 tracker, err := ct.factory()
77 if err != nil {
78 return nil, err
79 }
80 if frame.ctx == nil {
81 frame.ctx = evalContextPool.Get().(*evalContext)
82 }
83 frame.ctx.costs = tracker
84 return tracker, nil
85}
86
87// GetState extracts the CostTracker from the Activation.
88func (ct *costTrackerFactory) GetState(frame *ExecutionFrame) any {

Callers

nothing calls this directly

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected