aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorMarc Poulhiès <dkm@kataplop.net>2023-04-26 23:08:30 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:34:14 +0100
commit98142ce7cc4522fd9dadba0e458905611e5bacfc (patch)
tree4197e03f2227f11d29d4724fa93cd4edfd197746 /gcc/rust
parent8b7ab6f2f26c78309597f998c768e4e539db75bb (diff)
downloadgcc-98142ce7cc4522fd9dadba0e458905611e5bacfc.zip
gcc-98142ce7cc4522fd9dadba0e458905611e5bacfc.tar.gz
gcc-98142ce7cc4522fd9dadba0e458905611e5bacfc.tar.bz2
gccrs: Minor tuning in AST dump
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>
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/ast/rust-ast-dump.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc
index f8c4f50..c52de8b 100644
--- a/gcc/rust/ast/rust-ast-dump.cc
+++ b/gcc/rust/ast/rust-ast-dump.cc
@@ -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