added #903 to the test suite
This commit is contained in:
parent
9e66d988e7
commit
d15788d00a
5 changed files with 32 additions and 6 deletions
|
|
@ -12,13 +12,13 @@ import macros, tables
|
|||
var ZOOT{.compileTime.} = initTable[int, int](2)
|
||||
var iii {.compiletime.} = 1
|
||||
|
||||
macro x:stmt=
|
||||
macro zoo:stmt=
|
||||
zoot[iii] = iii*2
|
||||
inc iii
|
||||
echo iii
|
||||
|
||||
x
|
||||
x
|
||||
zoo
|
||||
zoo
|
||||
|
||||
|
||||
macro tupleUnpack: stmt =
|
||||
|
|
@ -27,3 +27,24 @@ macro tupleUnpack: stmt =
|
|||
|
||||
tupleUnpack
|
||||
|
||||
# bug #903
|
||||
|
||||
import strtabs
|
||||
|
||||
var x {.compileTime.}: PStringTable
|
||||
|
||||
macro addStuff(stuff, body: expr): stmt {.immediate.} =
|
||||
result = newNimNode(nnkStmtList)
|
||||
|
||||
if x.isNil:
|
||||
x = newStringTable(modeStyleInsensitive)
|
||||
x[$stuff] = ""
|
||||
|
||||
macro dump(): stmt =
|
||||
result = newNimNode(nnkStmtList)
|
||||
for y in x.keys: echo "Got ", y
|
||||
|
||||
addStuff("Hey"): echo "Hey"
|
||||
addStuff("Hi"): echo "Hi"
|
||||
dump()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue