fixes #9540
This commit is contained in:
parent
9d31dfdf1a
commit
680f5eeb15
1 changed files with 3 additions and 2 deletions
|
|
@ -125,6 +125,8 @@ macro `->`*(p, b: untyped): untyped =
|
||||||
type ListComprehension = object
|
type ListComprehension = object
|
||||||
var lc*: ListComprehension
|
var lc*: ListComprehension
|
||||||
|
|
||||||
|
template `|`*(lc: ListComprehension, comp: untyped): untyped = lc
|
||||||
|
|
||||||
macro `[]`*(lc: ListComprehension, comp, typ: untyped): untyped =
|
macro `[]`*(lc: ListComprehension, comp, typ: untyped): untyped =
|
||||||
## List comprehension, returns a sequence. `comp` is the actual list
|
## List comprehension, returns a sequence. `comp` is the actual list
|
||||||
## comprehension, for example ``x | (x <- 1..10, x mod 2 == 0)``. `typ` is
|
## 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)
|
expectLen(comp, 3)
|
||||||
expectKind(comp, nnkInfix)
|
expectKind(comp, nnkInfix)
|
||||||
expectKind(comp[0], nnkIdent)
|
assert($comp[0] == "|")
|
||||||
assert($comp[0].ident == "|")
|
|
||||||
|
|
||||||
result = newCall(
|
result = newCall(
|
||||||
newDotExpr(
|
newDotExpr(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue