aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Dupak <dev@jakubdupak.com>2022-11-16 14:16:51 +0100
committerJakub Dupak <dev@jakubdupak.com>2022-11-16 17:59:39 +0100
commit9527e9985890e30c7687c9482b669e3f5338f9fe (patch)
tree5f1b10cfe1f0b19de58b3451f3e5423e57e8c6c5 /gcc
parentb0ec92f7d4b577ff483e3d8992d4ea43f59dbfeb (diff)
downloadgcc-9527e9985890e30c7687c9482b669e3f5338f9fe.zip
gcc-9527e9985890e30c7687c9482b669e3f5338f9fe.tar.gz
gcc-9527e9985890e30c7687c9482b669e3f5338f9fe.tar.bz2
ast: Dump no comma after self in fn params if it is the last one
Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/ast/rust-ast-dump.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc
index 9ec847c..131e23e 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 << ") ";