Skip to content

Commit

Permalink
use :gensym
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Mar 10, 2021
1 parent bd61984 commit cb26ca6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/evaltempl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ proc evalTemplateAux(templ, actual: PNode, c: var TemplCtx, result: PNode) =
# internalAssert c.config, false
idTablePut(c.mapping, s, x)
if sfGenSym in s.flags:
result.add newIdentNode(getIdent(c.ic, x.name.s & "__gensym" & $c.instID),
# `__gensym` would also be an option, but would need patching
# `nep1CheckDefImpl` and identifier comparison.
# `:` is similar to `genPrefix` (we could also reuse it)
result.add newIdentNode(getIdent(c.ic, x.name.s & ":gensym" & $c.instID),
if c.instLines: actual.info else: templ.info)
else:
result.add newSymNode(x, if c.instLines: actual.info else: templ.info)
Expand Down

0 comments on commit cb26ca6

Please sign in to comment.