cgen: optimize a replace call

pull/4155/head
yuyi 2020-03-29 16:09:27 +08:00 committed by GitHub
parent a333ac1888
commit c9eed0b89b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -139,7 +139,7 @@ pub fn (g mut Gen) write_typeof_functions() {
pub fn (g mut Gen) typ(t table.Type) string { pub fn (g mut Gen) typ(t table.Type) string {
nr_muls := table.type_nr_muls(t) nr_muls := table.type_nr_muls(t)
sym := g.table.get_type_symbol(t) sym := g.table.get_type_symbol(t)
mut styp := sym.name.replace_each(['.', '__']) mut styp := sym.name.replace('.', '__')
if nr_muls > 0 { if nr_muls > 0 {
styp += strings.repeat(`*`, nr_muls) styp += strings.repeat(`*`, nr_muls)
} }
@ -162,7 +162,7 @@ pub fn (g mut Gen) typ(t table.Type) string {
/* /*
pub fn (g &Gen) styp(t string) string { pub fn (g &Gen) styp(t string) string {
return t.replace_each(['.', '__']) return t.replace('.', '__')
} }
*/ */