ast: small cleanup of using simple string interpolation in a string builder .write_string/1 parameter

pull/13777/head
Delyan Angelov 2022-03-19 17:25:53 +02:00
parent 0cc63107ff
commit 4dd68d3965
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 8 additions and 5 deletions

View File

@ -1186,7 +1186,7 @@ pub fn (t &Table) fn_signature_using_aliases(func &Fn, import_aliases map[string
// TODO write receiver
}
if !opts.type_only {
sb.write_string('$func.name')
sb.write_string(func.name)
}
sb.write_string('(')
start := int(opts.skip_receiver)
@ -1203,18 +1203,21 @@ pub fn (t &Table) fn_signature_using_aliases(func &Fn, import_aliases map[string
sb.write_string('mut ')
}
if !opts.type_only {
sb.write_string('$param.name ')
sb.write_string(param.name)
sb.write_string(' ')
}
styp := t.type_to_str_using_aliases(typ, import_aliases)
if i == func.params.len - 1 && func.is_variadic {
sb.write_string('...$styp')
sb.write_string('...')
sb.write_string(styp)
} else {
sb.write_string('$styp')
sb.write_string(styp)
}
}
sb.write_string(')')
if func.return_type != ast.void_type {
sb.write_string(' ${t.type_to_str_using_aliases(func.return_type, import_aliases)}')
sb.write_string(' ')
sb.write_string(t.type_to_str_using_aliases(func.return_type, import_aliases))
}
return sb.str()
}