summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2014-11-03 01:56:44 +0100
committerAndreas Rumpf <rumpf_a@web.de>2014-11-03 01:56:44 +0100
commite7edd9e64e6501f318ed5ad76604e6252b1d5ac3 (patch)
treeb459af5f761127a6b27aa2d0cdfdd1393102c1da /lib
parent621ead411062c1d3682a8b3414a970f12b43f7ac (diff)
parentaa1fb9a07ea3d48f7350c3dd9a26f2c22e38ae67 (diff)
downloadNim-e7edd9e64e6501f318ed5ad76604e6252b1d5ac3.tar.gz
Merge pull request #1565 from gradha/pr_supports_nnkPostfix_stringification
Adds stringification support for nnkPostfix nodes.
Diffstat (limited to 'lib')
-rw-r--r--lib/core/macros.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index e290cce32..455f99c9e 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim
@@ -620,6 +620,8 @@ proc `body=`*(someProc: PNimrodNode, val: PNimrodNode) {.compileTime.} =
     someProc[high(someProc)] = val
   else:
     badNodeKind someProc.kind, "body=" 
+
+proc basename*(a: PNimrodNode): PNimrodNode {.compiletime.}
   
 
 proc `$`*(node: PNimrodNode): string {.compileTime.} =
@@ -627,6 +629,8 @@ proc `$`*(node: PNimrodNode): string {.compileTime.} =
   case node.kind
   of nnkIdent:
     result = $node.ident
+  of nnkPostfix:
+    result = $node.basename.ident & "*"
   of nnkStrLit..nnkTripleStrLit:
     result = node.strVal
   else: 
@@ -669,7 +673,7 @@ proc insert*(a: PNimrodNode; pos: int; b: PNimrodNode) {.compileTime.} =
       a[i + 1] = a[i]
     a[pos] = b
 
-proc basename*(a: PNimrodNode): PNimrodNode {.compiletime.} =
+proc basename*(a: PNimrodNode): PNimrodNode =
   ## Pull an identifier from prefix/postfix expressions
   case a.kind
   of nnkIdent: return a