From c6099df4184f52ba078bb7e6c94bf781142ce778 Mon Sep 17 00:00:00 2001 From: yuyi Date: Fri, 15 Jan 2021 14:51:28 +0800 Subject: [PATCH] cgen: fix c struct str method (#8117) --- vlib/v/gen/auto_str_methods.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/v/gen/auto_str_methods.v b/vlib/v/gen/auto_str_methods.v index 5261008863..b1315b885c 100644 --- a/vlib/v/gen/auto_str_methods.v +++ b/vlib/v/gen/auto_str_methods.v @@ -281,7 +281,7 @@ fn (mut g Gen) gen_str_for_array_fixed(info table.ArrayFixed, styp string, str_f } else { g.auto_str_funcs.writeln('\tfor (int i = 0; i < $info.size; ++i) {') if sym.kind == .struct_ && !sym_has_str_method { - g.auto_str_funcs.writeln('\t\tstrings__Builder_write(&sb, ${elem_str_fn_name}(a[i], indent_count));') + g.auto_str_funcs.writeln('\t\tstrings__Builder_write(&sb, ${elem_str_fn_name}(a[i]));') } else if sym.kind in [.f32, .f64] { g.auto_str_funcs.writeln('\t\tstrings__Builder_write(&sb, _STR("%g", 1, a[i]));') } else if sym.kind == .string { @@ -631,5 +631,5 @@ fn (mut g Gen) gen_str_for_fn_type(info table.FnType, styp string, str_fn_name s [inline] fn styp_to_str_fn_name(styp string) string { - return styp.replace_each(['*', '', '.', '__']) + '_str' + return styp.replace_each(['*', '', '.', '__', ' ', '__']) + '_str' }