summary refs log tree commit diff stats
path: root/lib/pure
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 /lib/pure
parent9d31dfdf1ad49473cac1f04d7777876bbafd0481 (diff)
downloadNim-680f5eeb15583f45dc2dcdbc4f05a6557d09f31a.tar.gz
fixes #9540
Diffstat (limited to 'lib/pure')
-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(
fc0f8fd3763a572e0e180c04'>e4ac3c9e ^
7452d052 ^















5fe060d5 ^

06e0edba ^












































7452d052 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129