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 format_{tuple, struct}_field helpers Date: Mon, 10 Oct 2022 07:33:43 +0000 (GMT) [thread overview] Message-ID: <20221010073343.61E783858285@sourceware.org> (raw) https://gcc.gnu.org/g:1f9d7ec437307c02427e2977806be656a28c360a commit 1f9d7ec437307c02427e2977806be656a28c360a Author: David Faust <david.faust@oracle.com> Date: Thu Oct 6 13:43:06 2022 -0700 ast: dump: add format_{tuple,struct}_field helpers Diff: --- gcc/rust/ast/rust-ast-dump.cc | 17 +++++++++++++++++ gcc/rust/ast/rust-ast-dump.h | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index b192556647c..6f2f81630b0 100644 --- a/gcc/rust/ast/rust-ast-dump.cc +++ b/gcc/rust/ast/rust-ast-dump.cc @@ -156,6 +156,23 @@ Dump::emit_generic_params (std::vector<std::unique_ptr<GenericParam>> ¶ms) stream << ">"; } +void +Dump::format_tuple_field (TupleField &field) +{ + // TODO: do we need to emit outer attrs here? + emit_visibility (field.get_visibility ()); + field.get_field_type ()->accept_vis (*this); +} + +void +Dump::format_struct_field (StructField &field) +{ + // TODO: do we need to emit outer attrs here? + emit_visibility (field.get_visibility ()); + stream << field.get_field_name () << ": "; + field.get_field_type ()->accept_vis (*this); +} + void Dump::visit (Token &tok) {} diff --git a/gcc/rust/ast/rust-ast-dump.h b/gcc/rust/ast/rust-ast-dump.h index 1bbefb38454..2da2736c95b 100644 --- a/gcc/rust/ast/rust-ast-dump.h +++ b/gcc/rust/ast/rust-ast-dump.h @@ -100,6 +100,12 @@ private: // Emit formatted string for generic parameters. void emit_generic_params (std::vector<std::unique_ptr<GenericParam>> ¶ms); + // Format a single field of a tuple. + void format_tuple_field (TupleField &field); + + // Format a single field of a struct. + void format_struct_field (StructField &field); + // rust-ast.h void visit (Token &tok); void visit (DelimTokenTree &delim_tok_tree);
reply other threads:[~2022-10-10 7:33 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=20221010073343.61E783858285@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).