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

cgen: minor cleanup (use replace_each) (#6978)

This commit is contained in:
Swastik Baranwal 2020-11-27 20:43:30 +05:30 committed by GitHub
parent bbea7fb91f
commit 2473f65278
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -509,8 +509,7 @@ fn (g &Gen) cc_type2(t table.Type) string {
}
styp += sgtyps
} else if styp.contains('<') {
// TODO: yuck
styp = styp.replace('<', '_T_').replace('>', '').replace(',', '_')
styp = styp.replace_each(['<', '_T_', '>', '', ',', '_'])
}
}
return styp
@ -4512,9 +4511,8 @@ fn (mut g Gen) write_types(types []table.TypeSymbol) {
if typ.info.generic_types.len > 0 {
continue
}
// TODO: yuck
if name.contains('<') {
name = name.replace('<', '_T_').replace('>', '').replace(',', '_')
name = name.replace_each(['<', '_T_', '>', '', ',', '_'])
g.typedefs.writeln('typedef struct $name $name;')
}
// TODO avoid buffer manip