InitState produces an EvalState instance and bundles it into the ExecutionFrame in a way which is not visible to expression evaluation.
(frame *ExecutionFrame)
| 126 | // InitState produces an EvalState instance and bundles it into the ExecutionFrame in a way which is |
| 127 | // not visible to expression evaluation. |
| 128 | func (et *evalStateFactory) InitState(frame *ExecutionFrame) (any, error) { |
| 129 | if frame.ctx != nil && frame.ctx.state != nil { |
| 130 | return frame.ctx.state, nil |
| 131 | } |
| 132 | state := et.factory() |
| 133 | if frame.ctx == nil { |
| 134 | frame.ctx = evalContextPool.Get().(*evalContext) |
| 135 | } |
| 136 | frame.ctx.state = state |
| 137 | return state, nil |
| 138 | } |
| 139 | |
| 140 | // GetState extracts the EvalState from the Activation. |
| 141 | func (et *evalStateFactory) GetState(frame *ExecutionFrame) any { |