captureCostTracker records the frame's cost tracker within the evaluation details, allocating the details when cost tracking is enabled and no details have been created yet. The details must be fully populated before they are handed off to the caller, as any mutation after the hand-off would race w
(det *EvalDetails, frame *interpreter.ExecutionFrame)
| 234 | // The details must be fully populated before they are handed off to the caller, as any mutation |
| 235 | // after the hand-off would race with the caller's reads. |
| 236 | func captureCostTracker(det *EvalDetails, frame *interpreter.ExecutionFrame) *EvalDetails { |
| 237 | tracker := frame.CostTracker() |
| 238 | if tracker == nil { |
| 239 | return det |
| 240 | } |
| 241 | if det == nil { |
| 242 | det = &EvalDetails{} |
| 243 | } |
| 244 | det.costTracker = tracker |
| 245 | return det |
| 246 | } |
| 247 | |
| 248 | // prog is the internal implementation of the Program interface. |
| 249 | type prog struct { |
no test coverage detected