Skip to content

Commit

Permalink
parser: do not panic for v -silent -check-syntax bug.v, where bug.v…
Browse files Browse the repository at this point in the history
… is `mut z_buffer := [][]`
  • Loading branch information
spytheman committed Sep 16, 2023
1 parent 6698e28 commit bb95a27
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions vlib/v/parser/containers.v
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,18 @@ fn (mut p Parser) array_init(is_option bool) ast.ArrayInit {
elem_type = p.parse_type()
// this is set here because it's a known type, others could be the
// result of expr so we do those in checker
idx := p.table.find_or_register_array(elem_type)
if elem_type.has_flag(.generic) {
array_type = ast.new_type(idx).set_flag(.generic)
} else {
array_type = ast.new_type(idx)
}
if is_option {
array_type = array_type.set_flag(.option)
if elem_type != 0 {
idx := p.table.find_or_register_array(elem_type)
if elem_type.has_flag(.generic) {
array_type = ast.new_type(idx).set_flag(.generic)
} else {
array_type = ast.new_type(idx)
}
if is_option {
array_type = array_type.set_flag(.option)
}
has_type = true
}
has_type = true
}
last_pos = p.tok.pos()
} else {
Expand Down

0 comments on commit bb95a27

Please sign in to comment.