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

allow short struct initialization with Config structs

This commit is contained in:
Alexander Medvednikov
2020-01-14 15:34:47 +01:00
parent 0b235cc893
commit 6b3f54692a
3 changed files with 11 additions and 1 deletions

View File

@ -488,7 +488,9 @@ fn (p mut Parser) gen_struct_init(typ string, t &Type) bool {
if typ == 'tm' {
p.cgen.lines[p.cgen.lines.len - 1] = ''
}
p.next()
if p.tok != .lcbr {
p.next()
}
p.check(.lcbr)
ptr := typ.contains('*')
// `user := User{foo:bar}` => `User user = (User){ .foo = bar}`