mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix [] in if expr. closes #9131
This commit is contained in:
parent
2d73411396
commit
818be80581
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user