mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-09 14:32:53 +00:00
@@ -2242,8 +2242,7 @@ proc parseStmt(p: var Parser): PNode =
|
||||
break
|
||||
p.hasProgress = false
|
||||
if p.tok.tokType in {tkElse, tkElif}:
|
||||
parMessage(p, errInvalidIndentation)
|
||||
getTok(p)
|
||||
break # Allow this too, see tests/parser/tifexprs
|
||||
|
||||
result.add complexOrSimpleStmt(p)
|
||||
if not p.hasProgress and p.tok.tokType == tkEof: break
|
||||
|
||||
12
tests/parser/tifexprs.nim
Normal file
12
tests/parser/tifexprs.nim
Normal file
@@ -0,0 +1,12 @@
|
||||
discard """
|
||||
output: '''
|
||||
1
|
||||
'''
|
||||
"""
|
||||
|
||||
var a, b: int
|
||||
let x = if a > b:
|
||||
0
|
||||
else: 1
|
||||
|
||||
echo x
|
||||
Reference in New Issue
Block a user