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

Method InitState

interpreter/runtimecost.go:72–82  ·  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 tracker, err := ct.factory()
74 if err != nil {
75 return nil, err
76 }
77 if frame.ctx == nil {
78 frame.ctx = evalContextPool.Get().(*evalContext)
79 }
80 frame.ctx.costs = tracker
81 return tracker, nil
82}
83
84// GetState extracts the CostTracker from the Activation.
85func (ct *costTrackerFactory) GetState(frame *ExecutionFrame) any {

Callers

nothing calls this directly

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected