Skip to content

Commit cf864d9

Browse files
committed
address comments
1 parent ba708f8 commit cf864d9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/pure/sugar.nim

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ macro dump*(x: typed): untyped =
200200
return r
201201

202202
# TODO: consider exporting this in macros.nim
203-
proc replaceNodes(ast: NimNode): NimNode =
203+
proc freshIdentNodes(ast: NimNode): NimNode =
204204
# Replace NimIdent and NimSym by a fresh ident node
205205
# see also https://github.com/nim-lang/Nim/pull/8531#issuecomment-410436458
206206
proc inspect(node: NimNode): NimNode =
@@ -210,10 +210,9 @@ proc replaceNodes(ast: NimNode): NimNode =
210210
of nnkEmpty, nnkLiterals:
211211
result = node
212212
else:
213-
var rTree = node.kind.newTree()
213+
result = node.kind.newTree()
214214
for child in node:
215-
rTree.add inspect(child)
216-
result = rTree
215+
result.add inspect(child)
217216
result = inspect(ast)
218217

219218
macro distinctBase*(T: typedesc): untyped =
@@ -236,4 +235,4 @@ macro distinctBase*(T: typedesc): untyped =
236235
typeSym = typeSym[0]
237236
while typeSym.typeKind == ntyDistinct:
238237
typeSym = getTypeImpl(typeSym)[0]
239-
typeSym.replaceNodes
238+
typeSym.freshIdentNodes

0 commit comments

Comments
 (0)