Skip to content

Commit

Permalink
0.6.10: nested procedures take 2
Browse files Browse the repository at this point in the history
  • Loading branch information
disruptek committed Nov 30, 2022
1 parent 50992b8 commit 2177537
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cps.nimble
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "0.6.9"
version = "0.6.10"
author = "disruptek"
description = "continuation-passing style"
license = "MIT"
Expand Down
6 changes: 3 additions & 3 deletions cps/transform.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1142,9 +1142,6 @@ proc cpsTransformProc(tipe: NimNode, n: NimNode): NormNode =
n = clone n
n.addPragma "used" # avoid gratuitous warnings

# make a special rewrite pass to replace the result symbols
n = ProcDef: env.rewriteResult n

# the whelp is a limited bootstrap that merely creates
# the continuation without invoking it in a trampoline
let whelp = env.createWhelp(n, name)
Expand Down Expand Up @@ -1191,6 +1188,9 @@ proc cpsTransformProc(tipe: NimNode, n: NimNode): NormNode =
Trace.hook env.first, n # hooking against the proc (minus cloned body)
body.add n.body # add in the cloned body of the original proc

# replace the result symbols with the environment's result field
body = env.rewriteResult body

# perform sym substitutions (or whatever)
n.body = env.rewriteSymbolsIntoEnvDotField body

Expand Down

0 comments on commit 2177537

Please sign in to comment.