mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
table: optimize fn_type_signature() (#16552)
This commit is contained in:
parent
58e150df12
commit
dff61300fb
@ -213,16 +213,11 @@ pub fn set_global_table(t &Table) {
|
|||||||
pub fn (t &Table) fn_type_signature(f &Fn) string {
|
pub fn (t &Table) fn_type_signature(f &Fn) string {
|
||||||
mut sig := ''
|
mut sig := ''
|
||||||
for i, arg in f.params {
|
for i, arg in f.params {
|
||||||
// TODO: for now ignore mut/pts in sig for now
|
|
||||||
typ := arg.typ.set_nr_muls(0)
|
typ := arg.typ.set_nr_muls(0)
|
||||||
arg_type_sym := t.sym(typ)
|
if arg.is_mut {
|
||||||
if arg_type_sym.kind == .alias {
|
sig += 'mut_'
|
||||||
sig += arg_type_sym.cname
|
|
||||||
} else {
|
|
||||||
sig += arg_type_sym.str().to_lower().replace_each(['.', '__', '&', '', '[', 'arr_',
|
|
||||||
'chan ', 'chan_', 'map[', 'map_of_', ']', '_to_', '<', '_T_', ',', '_', ' ', '',
|
|
||||||
'>', '', '(', '_', ')', '_'])
|
|
||||||
}
|
}
|
||||||
|
sig += t.sym(typ).cname.to_lower()
|
||||||
if i < f.params.len - 1 {
|
if i < f.params.len - 1 {
|
||||||
sig += '_'
|
sig += '_'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user