summary refs log blame commit diff stats
path: root/tests/trmacros/tnorewrite.nim
blob: e6769246f5fc049889078b6da898ba606518f5f6 (plain) (tree)



















                                                
block:
  proc get(x: int): int = x

  template t{get(a)}(a: int): int =
    {.noRewrite.}:
      get(a) + 1

  doAssert get(0) == 1

block:
  var x: int

  template asgn{a = b}(a: int{lvalue}, b: int) =
    let newVal = b + 1
    # ^ this is needed but should it be?
    {.noRewrite.}:
      a = newVal

  x = 10
  doAssert x == 11, $x