From c787283d44bf9eb5b4a5d62e82eeb84795945262 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 9 Nov 2024 21:55:56 -0300 Subject: [PATCH] fix --- vlib/v/gen/c/str.v | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/vlib/v/gen/c/str.v b/vlib/v/gen/c/str.v index 09a273991ff3a1..1c4980c380a889 100644 --- a/vlib/v/gen/c/str.v +++ b/vlib/v/gen/c/str.v @@ -204,13 +204,8 @@ fn (mut g Gen) gen_expr_to_string(expr ast.Expr, etype ast.Type) { } else { is_var_mut := expr.is_auto_deref_var() str_fn_name := g.get_str_fn(typ) - if sym.kind != .function { - if is_ptr && !is_var_mut { - g.write('isnil(') - g.expr_with_cast(expr, typ, typ) - g.write(') ? _SLIT("nil") : ') - } - g.write('${str_fn_name}(') + g.write('${str_fn_name}(') + if sym.kind != .function { if str_method_expects_ptr && !is_ptr && !typ.has_flag(.option) { g.write('&') } else if (!str_method_expects_ptr && is_ptr && !is_shared) || is_var_mut { @@ -224,9 +219,8 @@ fn (mut g Gen) gen_expr_to_string(expr ast.Expr, etype ast.Type) { g.write(')') } else if typ.has_flag(.option) { // only Option fn receive argument - g.write('${str_fn_name}(') g.expr_with_cast(expr, typ, typ) - g.write(')') } + g.write(')') } }