Skip to content

Commit

Permalink
fix fmt of optional reference
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyi98 committed Jul 9, 2024
1 parent 6265ac8 commit 0522f2f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions vlib/v/ast/str.v
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,12 @@ fn (t &Table) stringify_fn_after_name(node &FnDecl, mut f strings.Builder, cur_m
} else {
mut s := t.type_to_str(param.typ.clear_flag(.shared_f))
if param.is_mut {
if (!param_sym.is_number() && param_sym.kind != .bool)
if s.starts_with('&') && ((!param_sym.is_number() && param_sym.kind != .bool)
|| node.language != .v
|| (param.typ.is_ptr() && t.sym(param.typ).kind == .struct_) {
|| (param.typ.is_ptr() && t.sym(param.typ).kind == .struct_)) {
s = s[1..]
} else if param.typ.is_ptr() && t.sym(param.typ).kind == .struct_
&& !s.contains('[') {
s = t.type_to_str(param.typ.clear_flag(.shared_f).deref())
}
}
Expand Down

0 comments on commit 0522f2f

Please sign in to comment.