From d4290f0d2a11defd671999322c4a8f6b40ad9f92 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Mon, 13 Apr 2026 05:45:34 +0300 Subject: [PATCH] all: vfmt after recent changes --- cmd/tools/vdoc/document/doc.v | 9 +++++---- cmd/tools/vpm/settings.v | 18 ------------------ vlib/v/gen/c/fn.v | 4 ++-- vlib/v/gen/c/if.v | 3 ++- vlib/v/gen/c/testdata/volatile.vv | 2 +- vlib/v/gen/native/tests/typeof.vv | 2 +- 6 files changed, 11 insertions(+), 27 deletions(-) diff --git a/cmd/tools/vdoc/document/doc.v b/cmd/tools/vdoc/document/doc.v index 104cecccb..b6b2c0a1a 100644 --- a/cmd/tools/vdoc/document/doc.v +++ b/cmd/tools/vdoc/document/doc.v @@ -506,10 +506,11 @@ pub fn (mut d Doc) file_asts(mut file_asts []ast.File) ! { fname_has_set = true } if d.with_head && i == 0 { - mut module_name := file_ast.mod.name - // if module_name != 'main' && d.parent_mod_name.len > 0 { - // module_name = d.parent_mod_name + '.' + module_name - // } + mut module_name := if d.parent_mod_name.len > 0 && file_ast.mod.short_name != 'main' { + d.parent_mod_name + '.' + file_ast.mod.short_name + } else { + file_ast.mod.short_name + } d.head = DocNode{ name: module_name content: 'module ${module_name}' diff --git a/cmd/tools/vpm/settings.v b/cmd/tools/vpm/settings.v index 737db8883..2131ca445 100644 --- a/cmd/tools/vpm/settings.v +++ b/cmd/tools/vpm/settings.v @@ -111,21 +111,3 @@ fn unique_server_urls(urls []string) []string { fn normalize_server_url(url string) string { return url.trim_space().trim_string_right('/') } - -fn parse_server_urls(args []string) []string { - mut urls := []string{} - mut i := 0 - for i < args.len { - if args[i] in server_url_option_names { - i++ - if i < args.len { - url := normalize_server_url(args[i]) - if url != '' && url !in urls { - urls << url - } - } - } - i++ - } - return urls -} diff --git a/vlib/v/gen/c/fn.v b/vlib/v/gen/c/fn.v index 509963776..60a765986 100644 --- a/vlib/v/gen/c/fn.v +++ b/vlib/v/gen/c/fn.v @@ -5280,11 +5280,11 @@ fn (mut g Gen) autofree_call_pregen(node ast.CallExpr) { } else { scope.register(ast.Var{ name: t - typ: ast.string_type + typ: arg.typ is_autofree_tmp: true pos: node.pos }) - s = 'string ${t} = ' + s = '${g.styp(arg.typ)} ${t} = ' } g.is_autofree_tmp = true old_is_autofree := g.is_autofree diff --git a/vlib/v/gen/c/if.v b/vlib/v/gen/c/if.v index 10d5a4436..f81644404 100644 --- a/vlib/v/gen/c/if.v +++ b/vlib/v/gen/c/if.v @@ -302,8 +302,9 @@ fn (mut g Gen) if_expr(node ast.IfExpr) { // nested if on return stmt g.write2(g.styp(g.unwrap_generic(g.last_if_option_type)), ' ') } else if resolved_sym.kind == .function && resolved_sym.info is ast.FnType { + param_types := resolved_sym.info.func.params.map(it.typ) g.writeln('${g.fn_var_signature(resolved_typ, resolved_sym.info.func.return_type, - resolved_sym.info.func.params.map(it.typ), tmp)}; /* if prepend */') + param_types, tmp)}; /* if prepend */') declared_tmp = true } else { g.write('${styp} ') diff --git a/vlib/v/gen/c/testdata/volatile.vv b/vlib/v/gen/c/testdata/volatile.vv index 1cccc1e4d..91fee3de3 100644 --- a/vlib/v/gen/c/testdata/volatile.vv +++ b/vlib/v/gen/c/testdata/volatile.vv @@ -6,5 +6,5 @@ struct Abc { mut volatile zzz := 123 mut volatile pzzz := &zzz println(zzz) -println(&int(voidptr(pzzz))) +println(unsafe { &int(voidptr(pzzz)) }) println(Abc{}) diff --git a/vlib/v/gen/native/tests/typeof.vv b/vlib/v/gen/native/tests/typeof.vv index aadae8779..d85c3fcf7 100644 --- a/vlib/v/gen/native/tests/typeof.vv +++ b/vlib/v/gen/native/tests/typeof.vv @@ -28,7 +28,7 @@ fn main() { println(t5) t6 := typeof(charptr(0)) println(t6) - t7 := typeof(&u8(3)) + t7 := typeof(unsafe { &u8(3) }) println(t7) // functions -- 2.39.5