mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: array init &element fix
This commit is contained in:
parent
32c8eb6490
commit
4d3362358f
@ -1301,7 +1301,7 @@ fn (p mut Parser) array_init() ast.ArrayInit {
|
||||
line_nr := p.tok.line_nr
|
||||
p.check(.rsbr)
|
||||
// []string
|
||||
if p.tok.kind == .name && p.tok.line_nr == line_nr {
|
||||
if p.tok.kind in [.name, .amp] && p.tok.line_nr == line_nr {
|
||||
elem_type = p.parse_type()
|
||||
// this is set here becasue its a known type, others could be the
|
||||
// result of expr so we do those in checker
|
||||
@ -1321,7 +1321,7 @@ fn (p mut Parser) array_init() ast.ArrayInit {
|
||||
line_nr := p.tok.line_nr
|
||||
p.check(.rsbr)
|
||||
// [100]byte
|
||||
if exprs.len == 1 && p.tok.kind == .name && p.tok.line_nr == line_nr {
|
||||
if exprs.len == 1 && p.tok.kind in [.name, .amp] && p.tok.line_nr == line_nr {
|
||||
elem_type = p.parse_type()
|
||||
// p.warn('fixed size array')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user