From 99798b83b4143cfa8e6897402881eb376cbde46d Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 11 Aug 2020 17:30:37 +0200 Subject: [PATCH] parser: fix match/else check --- vlib/v/parser/if_match.v | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vlib/v/parser/if_match.v b/vlib/v/parser/if_match.v index ea71b9550a..a6635613f8 100644 --- a/vlib/v/parser/if_match.v +++ b/vlib/v/parser/if_match.v @@ -152,7 +152,8 @@ fn (mut p Parser) match_expr() ast.MatchExpr { p.next() var_name = p.check_name() } - if p.tok.kind == .lcbr { + no_lcbr := p.tok.kind != .lcbr + if !no_lcbr { p.check(.lcbr) } mut branches := []ast.MatchBranch{} @@ -258,7 +259,7 @@ fn (mut p Parser) match_expr() ast.MatchExpr { post_comments: post_comments } p.close_scope() - if p.tok.kind == .rcbr || is_else { + if p.tok.kind == .rcbr || (is_else && no_lcbr) { break } }