1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

if x := opt() {} else {}

This commit is contained in:
Alexander Medvednikov
2020-01-01 10:31:50 +01:00
parent 96d02849aa
commit 4794598d06
2 changed files with 23 additions and 16 deletions

View File

@ -265,6 +265,12 @@ fn (p mut Parser) if_statement(is_expr bool, elif_depth int) string {
p.statements()
p.close_scope()
p.returns = false
if p.tok == .key_else {
p.next()
p.genln('else {')
p.check(.lcbr)
p.statements()
}
return 'void'
}
else {