tnorewrite.nim 336 B

123456789101112131415161718192021
  1. block:
  2. proc get(x: int): int = x
  3. template t{get(a)}(a: int): int =
  4. {.noRewrite.}:
  5. get(a) + 1
  6. doAssert get(0) == 1
  7. block:
  8. var x: int
  9. template asgn{a = b}(a: int{lvalue}, b: int) =
  10. let newVal = b + 1
  11. # ^ this is needed but should it be?
  12. {.noRewrite.}:
  13. a = newVal
  14. x = 10
  15. doAssert x == 11, $x