added tests from issue #497
This commit is contained in:
parent
9bd72fc0d9
commit
43ddb4806b
2 changed files with 22 additions and 0 deletions
17
tests/macros/macro_bug.nim
Normal file
17
tests/macros/macro_bug.nim
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import macros
|
||||||
|
|
||||||
|
macro macro_bug*(s: stmt): stmt {.immediate.} =
|
||||||
|
s.expectKind({nnkProcDef, nnkMethodDef})
|
||||||
|
|
||||||
|
var params = s.params
|
||||||
|
|
||||||
|
let genericParams = s[2]
|
||||||
|
result = newNimNode(nnkProcDef).add(
|
||||||
|
s.name, s[1], genericParams, params, pragma(s), newEmptyNode())
|
||||||
|
|
||||||
|
var body = body(s)
|
||||||
|
|
||||||
|
# Fails here.
|
||||||
|
var call = newCall("macro_bug", s.params[1][0])
|
||||||
|
body.insert(0, call)
|
||||||
|
result.add(body)
|
||||||
5
tests/macros/tsame_name_497.nim
Normal file
5
tests/macros/tsame_name_497.nim
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
import macro_bug
|
||||||
|
|
||||||
|
type TObj = object
|
||||||
|
|
||||||
|
proc f(o: TObj) {.macro_bug.} = discard
|
||||||
Loading…
Add table
Add a link
Reference in a new issue