From 4d3362358f25732eab77e0f70febd15c3aa5a222 Mon Sep 17 00:00:00 2001 From: Joe Conigliaro Date: Wed, 25 Mar 2020 02:24:23 +1100 Subject: [PATCH] parser: array init &element fix --- vlib/v/parser/parser.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index d5f2c39316..c84990cfd7 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -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') }