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

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

This commit is contained in:
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

View File

@ -812,8 +812,13 @@ pub fn (t &Table) array_cname(elem_type Type) string {
if elem_type.is_ptr() {
res = '_ptr'.repeat(elem_type.nr_muls())
}
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.
// e. g. [16][8]int