Push pushes the given activation onto the activation stack and returns the new frame. This operation is internal to the interpreter and is used to handle comprehension and block scoping. The child frame inherits the shared evalContext from the parent.
(activation Activation)
| 211 | // This operation is internal to the interpreter and is used to handle comprehension |
| 212 | // and block scoping. The child frame inherits the shared evalContext from the parent. |
| 213 | func (f *ExecutionFrame) Push(activation Activation) *ExecutionFrame { |
| 214 | child := frameStack.Get().(*ExecutionFrame) |
| 215 | child.parent = f |
| 216 | child.ctx = f.ctx |
| 217 | child.costTracker = f.costTracker |
| 218 | child.scope = activation |
| 219 | // Scopes pushed during evaluation never supply late-bound functions, so the child inherits |
| 220 | // the bindings resolved for the evaluation rather than searching its own hierarchy. |
| 221 | child.functions = f.functions |
| 222 | return child |
| 223 | } |
| 224 | |
| 225 | // Pop returns the parent frame, releasing the current frame back to the pool. |
| 226 | func (f *ExecutionFrame) Pop() *ExecutionFrame { |