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

v.ast table: minor simplification of generic_struct_insts_to_concrete() (#9667)

This commit is contained in:
yuyi 2021-04-11 15:29:31 +08:00 committed by GitHub
parent cca06fce90
commit 3241611871
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1098,14 +1098,12 @@ pub fn (mut t Table) generic_struct_insts_to_concrete() {
mut parent_info := parent.info as Struct mut parent_info := parent.info as Struct
mut fields := parent_info.fields.clone() mut fields := parent_info.fields.clone()
if parent_info.generic_types.len == info.generic_types.len { if parent_info.generic_types.len == info.generic_types.len {
for i, _ in fields { for i in 0 .. fields.len {
mut field := fields[i] if t_typ := t.resolve_generic_by_types(fields[i].typ, parent_info.generic_types,
if t_typ := t.resolve_generic_by_types(field.typ, parent_info.generic_types,
info.generic_types) info.generic_types)
{ {
field.typ = t_typ fields[i].typ = t_typ
} }
fields[i] = field
} }
parent_info.generic_types = [] parent_info.generic_types = []
parent_info.concrete_types = info.generic_types.clone() parent_info.concrete_types = info.generic_types.clone()