From 98142ce7cc4522fd9dadba0e458905611e5bacfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Wed, 26 Apr 2023 23:08:30 +0200 Subject: gccrs: Minor tuning in AST dump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- gcc/rust/ast/rust-ast-dump.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc') 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 -- cgit v1.1