public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-6243] gccrs: ast: Dump no comma after self in fn params if it is the last one
@ 2023-02-21 12:02 Arthur Cohen
0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2023-02-21 12:02 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:567494f7030b45e79b33ab38ba769826e370280e
commit r13-6243-g567494f7030b45e79b33ab38ba769826e370280e
Author: Jakub Dupak <dev@jakubdupak.com>
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 <dev@jakubdupak.com>
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 << ") ";
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-21 12:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-21 12:02 [gcc r13-6243] gccrs: ast: Dump no comma after self in fn params if it is the last one Arthur Cohen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).