1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: fix struct attribute for array struct field

This commit is contained in:
Ned Palacios 2020-05-08 19:09:40 +08:00 committed by GitHub
parent fec7f0f0b9
commit 13b11a4155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -20,7 +20,11 @@ pub fn (mut p Parser) parse_array_type() table.Type {
p.check(.rsbr)
elem_type := p.parse_type()
mut nr_dims := 1
for p.tok.kind == .lsbr {
// detect attr
not_attr := p.peek_tok.kind != .name && p.peek_tok2.kind !in [.semicolon, .rsbr]
for p.tok.kind == .lsbr && not_attr {
p.next()
p.check(.rsbr)
nr_dims++

View File

@ -17,6 +17,12 @@ mut:
num int
}
struct Lol {
b []string [json:lol]
c string [json:cc]
d int
}
struct User {
name string
age int