]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Minor tuning in AST dump
authorMarc Poulhiès <dkm@kataplop.net>
Wed, 26 Apr 2023 21:08:30 +0000 (23:08 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:34:14 +0000 (18:34 +0100)
Use parentheses to remove any ambiguities when dumping expressions with
unary ! and -.

gcc/rust/ChangeLog:
* ast/rust-ast-dump.cc (Dump::visit): print parentheses around
unique expression operand.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
gcc/rust/ast/rust-ast-dump.cc

index f8c4f50c27d72c37867c2b8c9bc20935b9af8dcf..c52de8b6a029bfe461fbdf58a2a7c457c8632936 100644 (file)
@@ -554,13 +554,14 @@ Dump::visit (NegationExpr &expr)
   switch (expr.get_expr_type ())
     {
     case NegationOperator::NEGATE:
-      stream << '-';
+      stream << "-(";
       break;
     case NegationOperator::NOT:
-      stream << '!';
+      stream << "!(";
       break;
     }
   visit (expr.get_negated_expr ());
+  stream << ')';
 }
 
 void