Merge pull request #2047 from reactormonk/tests-for-497

added tests from issue #497
This commit is contained in:
Andreas Rumpf
2015-02-04 10:39:24 +01:00
2 changed files with 22 additions and 0 deletions

View 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)

View File

@@ -0,0 +1,5 @@
import macro_bug
type TObj = object
proc f(o: TObj) {.macro_bug.} = discard