parser: fix multi fixed arrays init (#7996)
parent
a8dd13f086
commit
704f38d87f
|
@ -1305,3 +1305,8 @@ fn test_array_of_map_insert() {
|
||||||
println(x)
|
println(x)
|
||||||
assert '$x' == "[{}, {}, {'123': 123}, {}]"
|
assert '$x' == "[{}, {}, {'123': 123}, {}]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn test_multi_fixed_array_init() {
|
||||||
|
a := [3][3]int{}
|
||||||
|
assert '$a' == '[[0, 0, 0], [0, 0, 0], [0, 0, 0]]'
|
||||||
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ fn (mut p Parser) array_init() ast.ArrayInit {
|
||||||
}
|
}
|
||||||
last_pos = p.tok.position()
|
last_pos = p.tok.position()
|
||||||
p.check(.rsbr)
|
p.check(.rsbr)
|
||||||
if exprs.len == 1 && p.tok.kind in [.name, .amp] && p.tok.line_nr == line_nr {
|
if exprs.len == 1 && p.tok.kind in [.name, .amp, .lsbr] && p.tok.line_nr == line_nr {
|
||||||
// [100]byte
|
// [100]byte
|
||||||
elem_type = p.parse_type()
|
elem_type = p.parse_type()
|
||||||
is_fixed = true
|
is_fixed = true
|
||||||
|
|
Loading…
Reference in New Issue