summary refs log tree commit diff stats
path: root/tests/compile
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2012-03-26 04:36:26 +0300
committerZahary Karadjov <zahary@gmail.com>2012-03-26 04:36:26 +0300
commit6216046bc6b2794d15705f5d2621f602bda636c4 (patch)
tree8a70def0c70dc634ee92d1144c4b12e661042343 /tests/compile
parentbc2eb0ea9b8a806ddafdb7726c94363fbd2c2f20 (diff)
downloadNim-6216046bc6b2794d15705f5d2621f602bda636c4.tar.gz
genSym support for hygienic macros and templates.
example:
template hygienic(val: expr) =
  var `*x` = val
  echo `*x`

*x was chosen as mnemonic for "opposite of public" and thus private
Diffstat (limited to 'tests/compile')
-rw-r--r--tests/compile/tgensym.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/compile/tgensym.nim b/tests/compile/tgensym.nim
new file mode 100644
index 000000000..3c0405136
--- /dev/null
+++ b/tests/compile/tgensym.nim
@@ -0,0 +1,12 @@
+template hygienic(val: expr) =
+  var `*x` = val
+  stdout.write `*x`
+
+var x = 100
+
+hygienic 1
+hygienic 2
+hygienic 3
+
+echo x
+