fixes #2123
This commit is contained in:
parent
df2fdaf3c5
commit
ece23d39bc
2 changed files with 12 additions and 0 deletions
|
|
@ -1597,6 +1597,7 @@ proc parseEnum(p: var TParser): PNode =
|
||||||
optInd(p, result)
|
optInd(p, result)
|
||||||
while true:
|
while true:
|
||||||
var a = parseSymbol(p)
|
var a = parseSymbol(p)
|
||||||
|
if a.kind == nkEmpty: return
|
||||||
if p.tok.indent >= 0 and p.tok.indent <= p.currInd:
|
if p.tok.indent >= 0 and p.tok.indent <= p.currInd:
|
||||||
add(result, a)
|
add(result, a)
|
||||||
break
|
break
|
||||||
|
|
|
||||||
11
tests/parser/twhen_in_enum.nim
Normal file
11
tests/parser/twhen_in_enum.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
discard """
|
||||||
|
errormsg: "identifier expected, but found 'keyword when'"
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #2123
|
||||||
|
type num = enum
|
||||||
|
NUM_NONE = 0
|
||||||
|
NUM_ALL = 1
|
||||||
|
when defined(macosx): NUM_OSX = 10 # only this differs for real
|
||||||
|
NUM_XTRA = 20
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue