Adds stringification support for nnkPostfix nodes.
This commit is contained in:
parent
c17c8e9afa
commit
aa1fb9a07e
1 changed files with 5 additions and 1 deletions
|
|
@ -621,12 +621,16 @@ proc `body=`*(someProc: PNimrodNode, val: PNimrodNode) {.compileTime.} =
|
|||
else:
|
||||
badNodeKind someProc.kind, "body="
|
||||
|
||||
proc basename*(a: PNimrodNode): PNimrodNode {.compiletime.}
|
||||
|
||||
|
||||
proc `$`*(node: PNimrodNode): string {.compileTime.} =
|
||||
## Get the string of an identifier node
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue