This commit is contained in:
Andreas Rumpf 2019-09-05 08:21:01 +02:00 • committed by GitHub
commit 58bcf6cd46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 62 additions and 15 deletions

View file

@ -890,12 +890,13 @@ macro mkHandlerTplts(handlers: untyped): untyped =
# <handler code block>
# ...
proc mkEnter(hdName, body: NimNode): NimNode =
quote do:
template `hdName`(s, p, start) =
template helper(hdName, body) {.dirty.} =
template hdName(s, p, start) =
let s {.inject.} = s
let p {.inject.} = p
let start {.inject.} = start
`body`
body
result = getAst(helper(hdName, body))
template mkLeave(hdPostf, body) {.dirty.} =
# this has to be dirty to be able to capture *result* as *length* in