From 324161187106cbbc784dd2de9ccaedf91142aab7 Mon Sep 17 00:00:00 2001 From: yuyi Date: Sun, 11 Apr 2021 15:29:31 +0800 Subject: [PATCH] v.ast table: minor simplification of generic_struct_insts_to_concrete() (#9667) --- vlib/v/ast/table.v | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/vlib/v/ast/table.v b/vlib/v/ast/table.v index fd322f239f..36a5208502 100644 --- a/vlib/v/ast/table.v +++ b/vlib/v/ast/table.v @@ -1098,14 +1098,12 @@ pub fn (mut t Table) generic_struct_insts_to_concrete() { mut parent_info := parent.info as Struct mut fields := parent_info.fields.clone() if parent_info.generic_types.len == info.generic_types.len { - for i, _ in fields { - mut field := fields[i] - if t_typ := t.resolve_generic_by_types(field.typ, parent_info.generic_types, + for i in 0 .. fields.len { + if t_typ := t.resolve_generic_by_types(fields[i].typ, parent_info.generic_types, info.generic_types) { - field.typ = t_typ + fields[i].typ = t_typ } - fields[i] = field } parent_info.generic_types = [] parent_info.concrete_types = info.generic_types.clone()