summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorB3liever <b3lievem@yandex.com>2018-10-30 15:42:48 +0200
committerB3liever <b3lievem@yandex.com>2018-10-30 15:42:48 +0200
commitfb75e3bb4947413ea44ef2f5486ff16fdbc3308c (patch)
treeb9d3d02ba19becdf320e18cab48b737fd7e3b1f6 /lib
parent45040a8716172b6e84a4ddee98531deb472f1442 (diff)
downloadNim-fb75e3bb4947413ea44ef2f5486ff16fdbc3308c.tar.gz
Fix names set and get procs in macros
Diffstat (limited to 'lib')
-rw-r--r--lib/core/macros.nim12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index 87daabb5b..a146117d0 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim
@@ -1087,10 +1087,18 @@ proc name*(someProc: NimNode): NimNode {.compileTime.} =
   someProc.expectRoutine
   result = someProc[0]
   if result.kind == nnkPostfix:
-    result = result[1]
+    if result[1].kind == nnkAccQuoted:
+      result = result[1][0]
+    else:
+      result = result[1]
+  elif result.kind == nnkAccQuoted:
+    result = result[0]
+
 proc `name=`*(someProc: NimNode; val: NimNode) {.compileTime.} =
   someProc.expectRoutine
-  someProc[0] = val
+  if someProc[0].kind == nnkPostfix:
+    someProc[0][1] = val
+  else: someProc[0] = val
 
 proc params*(someProc: NimNode): NimNode {.compileTime.} =
   someProc.expectRoutine