Added support for exceptions in coroutines and added exception test
Fix bug where first coroutine ending would terminate main loop
This commit is contained in:
parent
373e667dbc
commit
9a754156d7
2 changed files with 46 additions and 9 deletions
|
|
@ -45,6 +45,17 @@ var
|
|||
# a global variable for the root of all try blocks
|
||||
currException {.threadvar.}: ref Exception
|
||||
|
||||
type
|
||||
FrameState = tuple[framePtr: PFrame, excHandler: PSafePoint, currException: ref Exception]
|
||||
|
||||
proc getFrameState*(): FrameState {.compilerRtl, inl.} =
|
||||
return (framePtr, excHandler, currException)
|
||||
|
||||
proc setFrameState*(state: FrameState) {.compilerRtl, inl.} =
|
||||
framePtr = state.framePtr
|
||||
excHandler = state.excHandler
|
||||
currException = state.currException
|
||||
|
||||
proc getFrame*(): PFrame {.compilerRtl, inl.} = framePtr
|
||||
|
||||
proc popFrame {.compilerRtl, inl.} =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue