ast: fix vtl compile error of generic array type cname (#12555)

pull/12558/head
yuyi 2021-11-24 02:11:51 +08:00 committed by GitHub
parent 87f7a6d99f
commit e42db5bee2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -812,7 +812,12 @@ pub fn (t &Table) array_cname(elem_type Type) string {
if elem_type.is_ptr() {
res = '_ptr'.repeat(elem_type.nr_muls())
}
return 'Array_$elem_type_sym.cname' + res
if elem_type_sym.cname.contains('<') {
type_name := elem_type_sym.cname.replace_each(['<', '_T_', ', ', '_', '>', ''])
return 'Array_$type_name' + res
} else {
return 'Array_$elem_type_sym.cname' + res
}
}
// array_fixed_source_name generates the original name for the v source.