diff options
author | Arne Döring <arne.doering@gmx.net> | 2018-07-19 22:42:48 +0200 |
---|---|---|
committer | Arne Döring <arne.doering@gmx.net> | 2018-10-18 15:39:22 +0200 |
commit | 48697dc5bb5d23761e9b1679f064d03de4e7bdc8 (patch) | |
tree | 257ec86d13d1e6f8578235f84ab281acf673b300 /lib/core/macros.nim | |
parent | abe8ac196234f1cc10a2e0d197441b97faadf54c (diff) | |
download | Nim-48697dc5bb5d23761e9b1679f064d03de4e7bdc8.tar.gz |
added test case for `or` operator
Diffstat (limited to 'lib/core/macros.nim')
-rw-r--r-- | lib/core/macros.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index e4424690a..a3b02de5f 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -176,7 +176,7 @@ proc `[]=`*(n: NimNode, i: BackwardsIndex, child: NimNode) = ## set `n`'s `i`'th child to `child`. n[n.len - i.int] = child -template `or`*(a,b: NimNode): NimNode = +template `or`*(x, y: NimNode): NimNode = ## Evalutuate ``a`` and when it is not an empty node, return return ## it. Otherwise evaluate to ``b``. Can be used to chain several ## expressions that evaluates to the first expression that is not @@ -186,11 +186,11 @@ template `or`*(a,b: NimNode): NimNode = ## ## let node = mightBeEmpty() or mightAlsoBeEmpty() or fallbackNode - let arg = a + let arg = x if arg != nil and arg.kind != nnkEmpty: arg else: - b + y proc add*(father, child: NimNode): NimNode {.magic: "NAdd", discardable, noSideEffect, locks: 0.} |