diff --git a/compiler/ast/Expr.v b/compiler/ast/Expr.v index fbb73850..30562fa9 100644 --- a/compiler/ast/Expr.v +++ b/compiler/ast/Expr.v @@ -77,9 +77,9 @@ pub: pub struct IfBranch { pub: - cond ?Expr - stmts []Stmt - pos FilePos + cond ?Expr + expr Expr + pos FilePos } @[inline] diff --git a/compiler/parser/expr.v b/compiler/parser/expr.v index a28f7564..a8f62db3 100644 --- a/compiler/parser/expr.v +++ b/compiler/parser/expr.v @@ -341,14 +341,14 @@ fn (mut p Parser) parse_if_expr() ast.Expr { pos := p.tok.pos for { if p.accept(.kw_else) && p.tok.kind != .kw_if { - branches << ast.IfBranch{none, p.parse_stmts(), pos} + branches << ast.IfBranch{none, p.parse_expr(), pos} break } p.expect(.kw_if) p.expect(.lparen) cond := p.parse_expr() p.expect(.rparen) - branches << ast.IfBranch{cond, p.parse_stmts(), pos} + branches << ast.IfBranch{cond, p.parse_expr(), pos} if p.tok.kind != .kw_else { break }