public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] ast: Dump add proper `line_trailing` argument to `visit_items_as_block` Date: Tue, 8 Nov 2022 09:29:05 +0000 (GMT) [thread overview] Message-ID: <20221108092905.4A680385840B@sourceware.org> (raw) https://gcc.gnu.org/g:dd6296cffed6943de1cde7baead9177404323c4d commit dd6296cffed6943de1cde7baead9177404323c4d Author: Jakub Dupak <dev@jakubdupak.com> Date: Fri Oct 28 17:49:29 2022 +0200 ast: Dump add proper `line_trailing` argument to `visit_items_as_block` Signed-off-by: Jakub Dupak <dev@jakubdupak.com> Diff: --- gcc/rust/ast/rust-ast-dump.cc | 21 +++++++++++---------- gcc/rust/ast/rust-ast-dump.h | 4 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index 986a8b3ed13..191e328b134 100644 --- a/gcc/rust/ast/rust-ast-dump.cc +++ b/gcc/rust/ast/rust-ast-dump.cc @@ -101,7 +101,8 @@ Dump::visit_items_as_lines (T &collection, const std::string &trailing) template <typename T> void -Dump::visit_items_as_block (T &collection, char left_brace, char right_brace) +Dump::visit_items_as_block (T &collection, const std::string &line_trailing, + char left_brace, char right_brace) { if (collection.empty ()) { @@ -112,7 +113,7 @@ Dump::visit_items_as_block (T &collection, char left_brace, char right_brace) stream << left_brace << '\n'; indentation.increment (); - visit_items_as_lines (collection, ","); + visit_items_as_lines (collection, line_trailing); indentation.decrement (); stream << indentation << right_brace << '\n'; @@ -944,7 +945,7 @@ Dump::visit (StructStruct &struct_item) // FIXME: where-clause - visit_items_as_block (struct_item.get_fields ()); + visit_items_as_block (struct_item.get_fields (), ","); } void @@ -979,7 +980,7 @@ void Dump::visit (EnumItemStruct &item) { stream << item.get_identifier (); - visit_items_as_block (item.get_struct_fields ()); + visit_items_as_block (item.get_struct_fields (), ","); } void @@ -998,7 +999,7 @@ Dump::visit (Enum &enum_item) // FIXME: where-clause - visit_items_as_block (enum_item.get_variants ()); + visit_items_as_block (enum_item.get_variants (), ","); } void @@ -1010,7 +1011,7 @@ Dump::visit (Union &union_item) // FIXME: where-clause - visit_items_as_block (union_item.get_variants ()); + visit_items_as_block (union_item.get_variants (), ","); } void @@ -1114,7 +1115,7 @@ Dump::visit (Trait &trait) stream << ">"; } - visit_items_as_block (trait.get_trait_items ()); + visit_items_as_block (trait.get_trait_items (), ""); } void @@ -1129,7 +1130,7 @@ Dump::visit (InherentImpl &impl) // FIXME: Handle where-clause // FIXME: Handle inner attributes - visit_items_as_block (impl.get_impl_items ()); + visit_items_as_block (impl.get_impl_items (), ""); } void @@ -1182,7 +1183,7 @@ Dump::visit (ExternBlock &block) if (block.has_abi ()) stream << "\"" << block.get_abi () << "\" "; - visit_items_as_block (block.get_extern_items ()); + visit_items_as_block (block.get_extern_items (), ";"); } static std::pair<char, char> @@ -1277,7 +1278,7 @@ Dump::visit (MacroRulesDefinition &rules_def) stream << "macro_rules! " << rules_def.get_rule_name (); - visit_items_as_block (rules_def.get_rules ()); + visit_items_as_block (rules_def.get_rules (), ";"); } void diff --git a/gcc/rust/ast/rust-ast-dump.h b/gcc/rust/ast/rust-ast-dump.h index f63c214f41a..13c92123ea9 100644 --- a/gcc/rust/ast/rust-ast-dump.h +++ b/gcc/rust/ast/rust-ast-dump.h @@ -112,8 +112,8 @@ private: * collection to print only the delimiters with no new line inside. */ template <typename T> - void visit_items_as_block (T &collection, char left_brace = '{', - char right_brace = '}'); + void visit_items_as_block (T &collection, const std::string &line_trailing, + char left_brace = '{', char right_brace = '}'); /** * Visit common items of functions: Parameters, return type, block
reply other threads:[~2022-11-08 9:29 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221108092905.4A680385840B@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).