diff options
author | Araq <rumpf_a@web.de> | 2014-01-18 01:16:45 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-01-18 01:16:45 +0100 |
commit | 36afdca87f3757c8468cbfa622de693447df7e07 (patch) | |
tree | 3b739b667574c12dea389a17d9d84291fd355463 /tests/showoff/tonce.nim | |
parent | 5073914b8697a9fd1dc38bebef434b50850f2861 (diff) | |
parent | 3f8bfb1e988322ab60cc54184d63a00906260665 (diff) | |
download | Nim-36afdca87f3757c8468cbfa622de693447df7e07.tar.gz |
resolved conflicts with master
Diffstat (limited to 'tests/showoff/tonce.nim')
-rw-r--r-- | tests/showoff/tonce.nim | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/showoff/tonce.nim b/tests/showoff/tonce.nim new file mode 100644 index 000000000..6fc372e87 --- /dev/null +++ b/tests/showoff/tonce.nim @@ -0,0 +1,22 @@ +discard """ + output: '''first call of p +some call of p +new instantiation +some call of p''' +""" + +template once(body: stmt) = + var x {.global.} = false + if not x: + x = true + body + +proc p() = + once: + echo "first call of p" + echo "some call of p" + +p() +once: + echo "new instantiation" +p() |