table: minor cleanup of resolve_generic_to_concrete() (#10046)

pull/10062/head
yuyi 2021-05-09 03:27:58 +08:00 committed by GitHub
parent ef7454b5e2
commit a9eb8931ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -1030,8 +1030,7 @@ pub fn (mut t Table) resolve_generic_to_concrete(generic_type Type, generic_name
typ := concrete_types[index] typ := concrete_types[index]
return typ.derive(generic_type).clear_flag(.generic) return typ.derive(generic_type).clear_flag(.generic)
} else if sym.kind == .array { } else if sym.kind == .array {
info := sym.info as Array mut elem_type := (sym.info as Array).elem_type
mut elem_type := info.elem_type
mut elem_sym := t.get_type_symbol(elem_type) mut elem_sym := t.get_type_symbol(elem_type)
mut dims := 1 mut dims := 1
for mut elem_sym.info is Array { for mut elem_sym.info is Array {
@ -1045,9 +1044,8 @@ pub fn (mut t Table) resolve_generic_to_concrete(generic_type Type, generic_name
idx := t.find_or_register_array_with_dims(typ, dims) idx := t.find_or_register_array_with_dims(typ, dims)
return new_type(idx).derive(generic_type).clear_flag(.generic) return new_type(idx).derive(generic_type).clear_flag(.generic)
} }
} else if sym.kind == .chan { } else if mut sym.info is Chan {
info := sym.info as Chan if typ := t.resolve_generic_to_concrete(sym.info.elem_type, generic_names, concrete_types,
if typ := t.resolve_generic_to_concrete(info.elem_type, generic_names, concrete_types,
is_inst) is_inst)
{ {
idx := t.find_or_register_chan(typ, typ.nr_muls() > 0) idx := t.find_or_register_chan(typ, typ.nr_muls() > 0)