t14847.nim 351 B

123456789101112131415161718192021
  1. discard """
  2. output: "98"
  3. """
  4. import macros
  5. #bug #14847
  6. proc hello*(b: string) =
  7. echo b
  8. macro dispatch(pro: typed, params: untyped): untyped =
  9. var impl = pro.getImpl
  10. let id = ident(pro.strVal & "_coverage")
  11. impl[0] = id
  12. let call = newCall(id, params)
  13. result = newStmtList()
  14. result.add(impl)
  15. result.add(call)
  16. dispatch(hello, "98")