quasiquote.nim 207 B

123456789101112
  1. import macros
  2. macro check(ex: untyped): typed =
  3. var info = ex.lineinfo
  4. var expString = ex.toStrLit
  5. result = quote do:
  6. if not `ex`:
  7. echo `info`, ": Check failed: ", `expString`
  8. check 1 < 2