From f2100166c7c9bd0da33d842552a057ae77ec0327 Mon Sep 17 00:00:00 2001 From: yuyi Date: Mon, 8 Feb 2021 23:00:51 +0800 Subject: [PATCH] cgen: minor cleanup in gen_str_for_option (#8622) --- vlib/v/gen/c/auto_str_methods.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vlib/v/gen/c/auto_str_methods.v b/vlib/v/gen/c/auto_str_methods.v index 195d671c72..371bae4c03 100644 --- a/vlib/v/gen/c/auto_str_methods.v +++ b/vlib/v/gen/c/auto_str_methods.v @@ -138,7 +138,7 @@ fn (mut g Gen) gen_str_for_option(typ table.Type, styp string, str_fn_name strin g.auto_str_funcs.writeln('\tif (it.is_none) {') g.auto_str_funcs.writeln('\t\tres = _SLIT("none");') g.auto_str_funcs.writeln('\t} else if (it.ok) {') - if typ.is_string() { + if sym.kind == .string { g.auto_str_funcs.writeln('\t\tres = _STR("\'%.*s\\000\'", 2, ${parent_str_fn_name}(*($sym.cname*)it.data));') } else if sym.kind == .struct_ && !sym_has_str_method { g.auto_str_funcs.writeln('\t\tres = indent_${parent_str_fn_name}(*($sym.cname*)it.data, indent_count);')