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

cgen: minor cleanup in struct_init() (#16676)

This commit is contained in:
yuyi 2022-12-14 21:25:09 +08:00 committed by GitHub
parent 8ab4c7742c
commit 8e3a90ae79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,10 +37,8 @@ fn (mut g Gen) struct_init(node ast.StructInit) {
g.go_back(1) // delete the `&` already generated in `prefix_expr() g.go_back(1) // delete the `&` already generated in `prefix_expr()
} }
mut is_anon := false mut is_anon := false
if sym.kind == .struct_ { if mut sym.info is ast.Struct {
mut info := sym.info as ast.Struct is_anon = sym.info.is_anon
is_anon = info.is_anon
} }
if !g.inside_cinit && !is_anon { if !g.inside_cinit && !is_anon {