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

yuyi 2022-05-16 17:22:51 +08:00 committed by Jef Roosens
parent 4179e1cac2
commit 9eba367a46
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
1 changed files with 1 additions and 14 deletions

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