src/littlesugar/replaceNimNodeTree

Search:
Group by:

Procs

proc replace(node, target, dest: NimNode): NimNode {....raises: [], tags: [],
    forbids: [].}
Recursively replaces all NimNodesubtrees in node that matches target with dest.

Example:

macro foo(target, dest, body: untyped): untyped =
  replace(body, target, dest)

doAssert foo(min, max, min(3, 7)) == 7