Prevent vfmt from appending the module name to FnTypeDecl inside the same module (#5080)

pull/5086/head
div72 2020-05-28 02:19:24 +03:00 committed by GitHub
parent 4988d340b1
commit cecb7d29c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -382,7 +382,7 @@ pub fn (mut f Fmt) type_decl(node ast.TypeDecl) {
f.write('type $fn_name = fn (') f.write('type $fn_name = fn (')
for i, arg in fn_info.args { for i, arg in fn_info.args {
f.write(arg.name) f.write(arg.name)
mut s := f.table.type_to_str(arg.typ) mut s := f.table.type_to_str(arg.typ).replace(f.cur_mod + '.', '')
if arg.is_mut { if arg.is_mut {
f.write('mut ') f.write('mut ')
if s.starts_with('&') { if s.starts_with('&') {
@ -405,7 +405,7 @@ pub fn (mut f Fmt) type_decl(node ast.TypeDecl) {
} }
f.write(')') f.write(')')
if fn_info.return_type.idx() != table.void_type_idx { if fn_info.return_type.idx() != table.void_type_idx {
ret_str := f.table.type_to_str(fn_info.return_type) ret_str := f.table.type_to_str(fn_info.return_type).replace(f.cur_mod + '.', '')
f.write(' ' + ret_str) f.write(' ' + ret_str)
} }
} }