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

handle empty config structs

This commit is contained in:
Alexander Medvednikov
2020-01-24 18:57:32 +01:00
parent 2897bac549
commit f55646746c
3 changed files with 25 additions and 1 deletions

View File

@@ -903,7 +903,7 @@ fn (p mut Parser) factor() string {
return p.map_init()
}
peek2 := p.tokens[p.token_idx + 1]
if p.peek() == .name && peek2.tok == .colon {
if p.peek() == .rcbr || (p.peek() == .name && peek2.tok == .colon) {
if !p.expected_type.ends_with('Config') {
p.error('short struct initialization syntax only works with structs that end with `Config`')
}