parser: fix [] in if expr. closes #9131

pull/9134/head
Joe Conigliaro 2021-03-06 01:43:34 +11:00
parent 2d73411396
commit 818be80581
No known key found for this signature in database
GPG Key ID: C12F7136C08206F1
1 changed files with 1 additions and 1 deletions

View File

@ -105,7 +105,7 @@ fn (mut p Parser) array_init() ast.ArrayInit {
mut has_cap := false
mut len_expr := ast.Expr{}
mut cap_expr := ast.Expr{}
if p.tok.kind == .lcbr && exprs.len == 0 {
if p.tok.kind == .lcbr && exprs.len == 0 && !p.inside_if {
// `[]int{ len: 10, cap: 100}` syntax
p.next()
for p.tok.kind != .rcbr {