]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: ast: dump: minor fixups to IfExpr formatting
authorDavid Faust <david.faust@oracle.com>
Thu, 13 Oct 2022 16:27:35 +0000 (09:27 -0700)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 21 Feb 2023 11:36:33 +0000 (12:36 +0100)
gcc/rust/ChangeLog:

* ast/rust-ast-dump.cc (Dump::visit): Fix IfExpr formatting.

gcc/rust/ast/rust-ast-dump.cc

index 3b00c9fedb6846a3901fe97382ffd1e5481bd734..1ba84b8efa1ee79cb8a6783eb63451d6a6a50d56 100644 (file)
@@ -570,6 +570,7 @@ Dump::visit (IfExpr &expr)
 {
   stream << "if ";
   expr.vis_if_condition (*this);
+  stream << " ";
   expr.vis_if_block (*this);
 }
 
@@ -578,6 +579,7 @@ Dump::visit (IfExprConseqElse &expr)
 {
   stream << "if ";
   expr.vis_if_condition (*this);
+  stream << " ";
   expr.vis_if_block (*this);
   stream << indentation << "else ";
   expr.vis_else_block (*this);
@@ -588,8 +590,10 @@ Dump::visit (IfExprConseqIf &expr)
 {
   stream << "if ";
   expr.vis_if_condition (*this);
+  stream << " ";
   expr.vis_if_block (*this);
-  stream << indentation << "else if ";
+  stream << indentation << "else ";
+  // The "if" part of the "else if" is printed by the next visitor
   expr.vis_conseq_if_expr (*this);
 }