summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-10-28 14:26:35 +0100
committerAraq <rumpf_a@web.de>2018-10-29 10:06:36 +0100
commit680f5eeb15583f45dc2dcdbc4f05a6557d09f31a (patch)
tree8b9a1a15a46b20b7d71106ceb6ddc1676166a21f
parent9d31dfdf1ad49473cac1f04d7777876bbafd0481 (diff)
downloadNim-680f5eeb15583f45dc2dcdbc4f05a6557d09f31a.tar.gz
fixes #9540
-rw-r--r--lib/pure/sugar.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/pure/sugar.nim b/lib/pure/sugar.nim
index 8ded552d9..53c31e8c9 100644
--- a/lib/pure/sugar.nim
+++ b/lib/pure/sugar.nim
@@ -125,6 +125,8 @@ macro `->`*(p, b: untyped): untyped =
 type ListComprehension = object
 var lc*: ListComprehension
 
+template `|`*(lc: ListComprehension, comp: untyped): untyped = lc
+
 macro `[]`*(lc: ListComprehension, comp, typ: untyped): untyped =
   ## List comprehension, returns a sequence. `comp` is the actual list
   ## comprehension, for example ``x | (x <- 1..10, x mod 2 == 0)``. `typ` is
@@ -140,8 +142,7 @@ macro `[]`*(lc: ListComprehension, comp, typ: untyped): untyped =
 
   expectLen(comp, 3)
   expectKind(comp, nnkInfix)
-  expectKind(comp[0], nnkIdent)
-  assert($comp[0].ident == "|")
+  assert($comp[0] == "|")
 
   result = newCall(
     newDotExpr(