public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-6160] gccrs: ast: dump If expressions
@ 2023-02-21 11:55 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2023-02-21 11:55 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:aeed747093c27fcbb6f7ebd70014591e77ed6af5

commit r13-6160-gaeed747093c27fcbb6f7ebd70014591e77ed6af5
Author: David Faust <david.faust@oracle.com>
Date:   Wed Oct 5 10:11:38 2022 -0700

    gccrs: ast: dump If expressions
    
    gcc/rust/ChangeLog:
    
            * ast/rust-ast-dump.cc (Dump::visit): Implement visitor for If
            expressions.

Diff:
---
 gcc/rust/ast/rust-ast-dump.cc | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc
index f3d0e2d9974..bc4f7a3a5c1 100644
--- a/gcc/rust/ast/rust-ast-dump.cc
+++ b/gcc/rust/ast/rust-ast-dump.cc
@@ -534,15 +534,31 @@ Dump::visit (ForLoopExpr &expr)
 
 void
 Dump::visit (IfExpr &expr)
-{}
+{
+  stream << "if ";
+  expr.vis_if_condition (*this);
+  expr.vis_if_block (*this);
+}
 
 void
 Dump::visit (IfExprConseqElse &expr)
-{}
+{
+  stream << "if ";
+  expr.vis_if_condition (*this);
+  expr.vis_if_block (*this);
+  stream << indentation << "else ";
+  expr.vis_else_block (*this);
+}
 
 void
 Dump::visit (IfExprConseqIf &expr)
-{}
+{
+  stream << "if ";
+  expr.vis_if_condition (*this);
+  expr.vis_if_block (*this);
+  stream << indentation << "else if ";
+  expr.vis_conseq_if_expr (*this);
+}
 
 void
 Dump::visit (IfExprConseqIfLet &expr)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-21 11:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-21 11:55 [gcc r13-6160] gccrs: ast: dump If expressions 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).