parser: fix [] in if expr. closes #9131
parent
2d73411396
commit
818be80581
|
@ -105,7 +105,7 @@ fn (mut p Parser) array_init() ast.ArrayInit {
|
||||||
mut has_cap := false
|
mut has_cap := false
|
||||||
mut len_expr := ast.Expr{}
|
mut len_expr := ast.Expr{}
|
||||||
mut cap_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
|
// `[]int{ len: 10, cap: 100}` syntax
|
||||||
p.next()
|
p.next()
|
||||||
for p.tok.kind != .rcbr {
|
for p.tok.kind != .rcbr {
|
||||||
|
|
Loading…
Reference in New Issue