summary refs log tree commit diff stats
path: root/tests/macros/t14847.nim
blob: 0e6d0dd2de62fe2ed5b42100497a252b4acefe47 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
discard """
  output: "98"
"""
import macros

#bug #14847
proc hello*(b: string) =
  echo b

macro dispatch(pro: typed, params: untyped): untyped =
  var impl = pro.getImpl
  let id = ident(pro.strVal & "_coverage")
  impl[0] = id
  let call = newCall(id, params)

  result = newStmtList()
  result.add(impl)
  result.add(call)

dispatch(hello, "98")