From 0ab413312836bbe066cbcea7d3584767346bd4f2 Mon Sep 17 00:00:00 2001 From: yuyi Date: Mon, 16 May 2022 17:22:51 +0800 Subject: [PATCH] cgen: minor cleanup in struct_init() (#14405) --- vlib/v/gen/c/struct.v | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/vlib/v/gen/c/struct.v b/vlib/v/gen/c/struct.v index babf7fc7b3..f1f78eb4df 100644 --- a/vlib/v/gen/c/struct.v +++ b/vlib/v/gen/c/struct.v @@ -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