From 7c2f3e453007b50b51c552dce6f83f68a4475f27 Mon Sep 17 00:00:00 2001 From: yuyi Date: Mon, 7 Aug 2023 12:00:35 +0800 Subject: [PATCH] fmt: fix formatting of C.f(/*mut*/buff &char) i64 (#19069) --- vlib/v/fmt/tests/c_fn_headers_with_comments_expected.vv | 7 +++++++ vlib/v/fmt/tests/c_fn_headers_with_comments_input.vv | 7 +++++++ vlib/v/parser/fn.v | 1 + 3 files changed, 15 insertions(+) create mode 100644 vlib/v/fmt/tests/c_fn_headers_with_comments_expected.vv create mode 100644 vlib/v/fmt/tests/c_fn_headers_with_comments_input.vv diff --git a/vlib/v/fmt/tests/c_fn_headers_with_comments_expected.vv b/vlib/v/fmt/tests/c_fn_headers_with_comments_expected.vv new file mode 100644 index 0000000000..95934f8cc5 --- /dev/null +++ b/vlib/v/fmt/tests/c_fn_headers_with_comments_expected.vv @@ -0,0 +1,7 @@ +module main + +fn main() { + println('Hello World!') +} + +fn C.f( /* mut */ buff &char) i64 diff --git a/vlib/v/fmt/tests/c_fn_headers_with_comments_input.vv b/vlib/v/fmt/tests/c_fn_headers_with_comments_input.vv new file mode 100644 index 0000000000..88945f3ba4 --- /dev/null +++ b/vlib/v/fmt/tests/c_fn_headers_with_comments_input.vv @@ -0,0 +1,7 @@ +module main + +fn main() { + println('Hello World!') +} + +fn C.f(/*mut*/buff &char) i64 diff --git a/vlib/v/parser/fn.v b/vlib/v/parser/fn.v index f8bf4cd8ab..a16034b4d8 100644 --- a/vlib/v/parser/fn.v +++ b/vlib/v/parser/fn.v @@ -948,6 +948,7 @@ fn (mut p Parser) fn_params() ([]ast.Param, bool, bool) { is_mut: is_mut typ: param_type type_pos: type_pos + comments: comments } param_no++ if param_no > 1024 {