RemoveCallerFrame removes the stack frame above the current stack frame. This is useful in tail calls. It returns the new current frame.
()
| 2287 | // RemoveCallerFrame removes the stack frame above the current stack frame. This is useful in tail calls. It returns |
| 2288 | // the new current frame. |
| 2289 | func (ls *LState) RemoveCallerFrame() *callFrame { |
| 2290 | cs := ls.stack |
| 2291 | sp := cs.Sp() |
| 2292 | parentFrame := cs.At(sp - 2) |
| 2293 | currentFrame := cs.At(sp - 1) |
| 2294 | parentsParentFrame := parentFrame.Parent |
| 2295 | *parentFrame = *currentFrame |
| 2296 | parentFrame.Parent = parentsParentFrame |
| 2297 | parentFrame.Idx = sp - 2 |
| 2298 | cs.Pop() |
| 2299 | return parentFrame |
| 2300 | } |
| 2301 | |
| 2302 | /* }}} */ |
| 2303 |
no test coverage detected