Skip to content

Commit

Permalink
trampolineIt() moves and tears down continuation
Browse files Browse the repository at this point in the history
  • Loading branch information
disruptek committed Feb 12, 2023
1 parent 16f2efc commit 87c08cb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cps/spec.nim
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,9 @@ macro trampolineIt*[T: Continuation](supplied: T; body: untyped) =
result = quote:
var c: Continuation = `supplied`
while c.running:
var it {.used, inject.}: `T` = c
var it {.used, inject.}: `T` = move c
`body`
c = it
try:
var y = c.fn
var x = y(c)
Expand All @@ -536,6 +537,9 @@ macro trampolineIt*[T: Continuation](supplied: T; body: untyped) =
if not c.dismissed:
writeStackFramesImpl c
raise
if not c.dismissed:
reset c.mom
reset c

proc ensimilate*(source, destination: NormNode): Call =
## perform a call to convert the destination to the source's type;
Expand Down

0 comments on commit 87c08cb

Please sign in to comment.