cgen: minor cleanup (use replace_each) (#6978)
parent
bbea7fb91f
commit
2473f65278
|
@ -509,8 +509,7 @@ fn (g &Gen) cc_type2(t table.Type) string {
|
||||||
}
|
}
|
||||||
styp += sgtyps
|
styp += sgtyps
|
||||||
} else if styp.contains('<') {
|
} else if styp.contains('<') {
|
||||||
// TODO: yuck
|
styp = styp.replace_each(['<', '_T_', '>', '', ',', '_'])
|
||||||
styp = styp.replace('<', '_T_').replace('>', '').replace(',', '_')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return styp
|
return styp
|
||||||
|
@ -4512,9 +4511,8 @@ fn (mut g Gen) write_types(types []table.TypeSymbol) {
|
||||||
if typ.info.generic_types.len > 0 {
|
if typ.info.generic_types.len > 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// TODO: yuck
|
|
||||||
if name.contains('<') {
|
if name.contains('<') {
|
||||||
name = name.replace('<', '_T_').replace('>', '').replace(',', '_')
|
name = name.replace_each(['<', '_T_', '>', '', ',', '_'])
|
||||||
g.typedefs.writeln('typedef struct $name $name;')
|
g.typedefs.writeln('typedef struct $name $name;')
|
||||||
}
|
}
|
||||||
// TODO avoid buffer manip
|
// TODO avoid buffer manip
|
||||||
|
|
Loading…
Reference in New Issue