summary refs log tree commit diff stats
path: root/tests/macros
diff options
context:
space:
mode:
authorandri lim <jangko128@gmail.com>2018-08-06 04:38:21 +0700
committerAndreas Rumpf <rumpf_a@web.de>2018-08-05 23:38:21 +0200
commit6e3d1dced55229309a85849a45c877a798080453 (patch)
treeddb900044aee6d790dad6543a90b2ced02f9674b /tests/macros
parent6fffadb7fdd60174891fba6de302bb748cd7ca60 (diff)
downloadNim-6e3d1dced55229309a85849a45c877a798080453.tar.gz
fixes #5617, 'copyLineInfo' addition (#8523)
Diffstat (limited to 'tests/macros')
-rw-r--r--tests/macros/tlineinfo.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/macros/tlineinfo.nim b/tests/macros/tlineinfo.nim
new file mode 100644
index 000000000..2ab0e1ee8
--- /dev/null
+++ b/tests/macros/tlineinfo.nim
@@ -0,0 +1,14 @@
+# issue #5617, feature request
+# Ability to set a NimNode's lineinfo
+import macros
+
+type
+  Test = object
+
+macro mixer(n: typed): untyped =
+  let x = newIdentNode("echo")
+  x.copyLineInfo(n)
+  result = newLit(x.lineInfo == n.lineInfo)
+
+var z = mixer(Test)
+doAssert z