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

Method InitState

interpreter/runtimecost.go:71–84  ·  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

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

Callers

nothing calls this directly

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected