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

pull/9676/head
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
1 changed files with 3 additions and 5 deletions

View File

@ -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()