+inline-end
(L *LState, nargs int, haserror bool, kill bool)
| 79 | } // +inline-end |
| 80 | |
| 81 | func switchToParentThread(L *LState, nargs int, haserror bool, kill bool) { |
| 82 | parent := L.Parent |
| 83 | if parent == nil { |
| 84 | L.RaiseError("can not yield from outside of a coroutine") |
| 85 | } |
| 86 | L.G.CurrentThread = parent |
| 87 | L.Parent = nil |
| 88 | if !L.wrapped { |
| 89 | if haserror { |
| 90 | parent.Push(LFalse) |
| 91 | } else { |
| 92 | parent.Push(LTrue) |
| 93 | } |
| 94 | } |
| 95 | L.XMoveTo(parent, nargs) |
| 96 | L.stack.Pop() |
| 97 | offset := L.currentFrame.LocalBase - L.currentFrame.ReturnBase |
| 98 | L.currentFrame = L.stack.Last() |
| 99 | L.reg.SetTop(L.reg.Top() - offset) // remove 'yield' function(including tailcalled functions) |
| 100 | if kill { |
| 101 | L.kill() |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | func callGFunction(L *LState, tailcall bool) bool { |
| 106 | frame := L.currentFrame |