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() (#14405)

This commit is contained in:
yuyi 2022-05-16 17:22:51 +08:00 committed by GitHub
parent 36bec823c2
commit 0ab4133128
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,18 +46,7 @@ fn (mut g Gen) struct_init(node ast.StructInit) {
g.write('($styp){')
}
}
// mut fields := []string{}
mut inited_fields := map[string]int{} // TODO this is done in checker, move to ast node
/*
if node.fields.len == 0 && node.exprs.len > 0 {
// Get fields for {a,b} short syntax. Fields array wasn't set in the parser.
for f in info.fields {
fields << f.name
}
} else {
fields = node.fields
}
*/
mut inited_fields := map[string]int{}
if is_multiline {
g.indent++
}
@ -149,8 +138,6 @@ fn (mut g Gen) struct_init(node ast.StructInit) {
}
g.is_shared = old_is_shared2
}
// g.zero_struct_fields(info, inited_fields)
// nr_fields = info.fields.len
for mut field in info.fields {
if !field.typ.has_flag(.shared_f) {
g.is_shared = false