From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7905) id 676A53858C1F; Tue, 21 Feb 2023 12:02:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 676A53858C1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676980973; bh=J3y3reOVczAxcGZduqPAUPz2tzV1KpDY3oC7WTOdoB4=; h=From:To:Subject:Date:From; b=jOlxM/kWbtKig+4yENNtj3JgYNcTt0tobfat3Ls2JDMpY8XXsgkyCj/y5wspUCGxs EU3tUulad7NZ8KarNenT5n3POvMe163/fdRvoxrBUt/CjonYYKYgHMwGjPbqx/h4sT zv8Q5Jcwy3g0xaprjE2uZvGndNvo2a+EpAfsPu4g= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Arthur Cohen To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-6243] gccrs: ast: Dump no comma after self in fn params if it is the last one X-Act-Checkin: gcc X-Git-Author: Jakub Dupak X-Git-Refname: refs/heads/master X-Git-Oldrev: 0e44abb1b5095e00662c6c4980a1339b590449e0 X-Git-Newrev: 567494f7030b45e79b33ab38ba769826e370280e Message-Id: <20230221120253.676A53858C1F@sourceware.org> Date: Tue, 21 Feb 2023 12:02:53 +0000 (GMT) List-Id: https://gcc.gnu.org/g:567494f7030b45e79b33ab38ba769826e370280e commit r13-6243-g567494f7030b45e79b33ab38ba769826e370280e Author: Jakub Dupak Date: Wed Nov 16 14:16:51 2022 +0100 gccrs: ast: Dump no comma after self in fn params if it is the last one gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Fix dumping of fn params. Signed-off-by: Jakub Dupak Diff: --- gcc/rust/ast/rust-ast-dump.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index 9ec847c4f88..131e23ea180 100644 --- a/gcc/rust/ast/rust-ast-dump.cc +++ b/gcc/rust/ast/rust-ast-dump.cc @@ -1077,8 +1077,12 @@ Dump::visit (Method &method) visit (method.get_visibility ()); stream << "fn " << method.get_method_name () << '('; - stream << method.get_self_param ().as_string () << ", "; - visit_items_joined_by_separator (method.get_function_params (), ", "); + stream << method.get_self_param ().as_string (); + if (!method.get_function_params ().empty ()) + { + stream << ", "; + visit_items_joined_by_separator (method.get_function_params (), ", "); + } stream << ") "; @@ -1343,9 +1347,13 @@ Dump::visit (TraitItemMethod &item) // emit_visibility (method.get_visibility ()); stream << "fn " << method.get_identifier () << '('; - stream << method.get_self_param ().as_string () << ", "; + stream << method.get_self_param ().as_string (); - visit_items_joined_by_separator (method.get_function_params (), ", "); + if (!method.get_function_params ().empty ()) + { + stream << ", "; + visit_items_joined_by_separator (method.get_function_params (), ", "); + } stream << ") ";