diff options
Diffstat (limited to 'tests/macros/tmacro4.nim')
-rw-r--r-- | tests/macros/tmacro4.nim | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/macros/tmacro4.nim b/tests/macros/tmacro4.nim index a56369369..cb0399894 100644 --- a/tests/macros/tmacro4.nim +++ b/tests/macros/tmacro4.nim @@ -2,18 +2,16 @@ discard """ output: "after" """ -import - macros, strutils +import macros -macro test_macro*(n: stmt): stmt {.immediate.} = +macro test_macro*(s: string, n: untyped): untyped = result = newNimNode(nnkStmtList) var ass : NimNode = newNimNode(nnkAsgn) add(ass, newIdentNode("str")) add(ass, newStrLitNode("after")) add(result, ass) -when isMainModule: +when true: var str: string = "before" test_macro(str): var i : integer = 123 echo str - |