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: ArrayExpr
Date: Sat, 15 Oct 2022 09:15:53 +0000 (GMT)	[thread overview]
Message-ID: <20221015091553.54B3F385842F@sourceware.org> (raw)

https://gcc.gnu.org/g:6927e3ee00d22bca1ef2d3e5e58a0705a7578067

commit 6927e3ee00d22bca1ef2d3e5e58a0705a7578067
Author: David Faust <david.faust@oracle.com>
Date:   Thu Oct 13 10:14:38 2022 -0700

    ast: dump: ArrayExpr

Diff:
---
 gcc/rust/ast/rust-ast-dump.cc | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc
index ddc43b33512..91e540a1ee8 100644
--- a/gcc/rust/ast/rust-ast-dump.cc
+++ b/gcc/rust/ast/rust-ast-dump.cc
@@ -449,19 +449,43 @@ Dump::visit (GroupedExpr &expr)
 
 void
 Dump::visit (ArrayElemsValues &elems)
-{}
+{
+  auto &vals = elems.get_values ();
+  if (vals.size () >= 1)
+    {
+      vals[0]->accept_vis (*this);
+      for (size_t i = 1; i < vals.size (); i++)
+	{
+	  stream << ", ";
+	  vals[i]->accept_vis (*this);
+	}
+    }
+}
 
 void
 Dump::visit (ArrayElemsCopied &elems)
-{}
+{
+  elems.get_elem_to_copy ()->accept_vis (*this);
+  stream << "; ";
+  elems.get_num_copies ()->accept_vis (*this);
+}
 
 void
 Dump::visit (ArrayExpr &expr)
-{}
+{
+  stream << '[';
+  expr.get_array_elems ()->accept_vis (*this);
+  stream << ']';
+}
 
 void
 Dump::visit (ArrayIndexExpr &expr)
-{}
+{
+  expr.get_array_expr ()->accept_vis (*this);
+  stream << '[';
+  expr.get_index_expr ()->accept_vis (*this);
+  stream << ']';
+}
 
 void
 Dump::visit (TupleExpr &expr)

                 reply	other threads:[~2022-10-15  9:15 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=20221015091553.54B3F385842F@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: link
Be 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).