summary refs log tree commit diff stats
path: root/compiler/lambdalifting.nim
diff options
context:
space:
mode:
authorAdam Strzelecki <ono@java.pl>2015-06-02 21:29:28 +0200
committerAdam Strzelecki <ono@java.pl>2015-06-02 21:38:53 +0200
commit13b57dbc2f686ba9beb410ad9fef848926de38c5 (patch)
tree4f876def309e15da3baf0ad9f141e5f34b587995 /compiler/lambdalifting.nim
parent79c92603f505c388d370c5ef0dd8890e4e17e4e0 (diff)
downloadNim-13b57dbc2f686ba9beb410ad9fef848926de38c5.tar.gz
Introduce {.noRewrite.} expr pragma disabling TR
Term rewriting macros/templates are currently greedy and they will rewrite as
long as there is a match. So there was no way to ensure some rewrite happens
only once, eg. when rewriting term to same term plus extra content.

With new macro we can actually prevent further rewriting on marked expr or
stmts, eg. with given example echo(...) will be rewritten just once:

  template pwnEcho{echo(x)}(x: expr) =
    {.noRewrite.}: echo("pwned!")

  echo "ab"
Diffstat (limited to 'compiler/lambdalifting.nim')
0 files changed, 0 insertions, 0 deletions