aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Faust <david.faust@oracle.com>2022-10-13 09:28:33 -0700
committerDavid Faust <david.faust@oracle.com>2022-10-13 13:31:40 -0700
commit191907df1fd4d09567cc1e05835564df727cfb13 (patch)
tree1d370f92883a8a046bdd1176a0819b65047bc53b
parent45326391da3e6800fa0a9e1f89420ac3a5ae340b (diff)
downloadgcc-191907df1fd4d09567cc1e05835564df727cfb13.zip
gcc-191907df1fd4d09567cc1e05835564df727cfb13.tar.gz
gcc-191907df1fd4d09567cc1e05835564df727cfb13.tar.bz2
ast: dump: ComparisonExpr and LazyBooleanExpr
-rw-r--r--gcc/rust/ast/rust-ast-dump.cc50
1 files changed, 48 insertions, 2 deletions
diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc
index 1ba84b8..ddc43b3 100644
--- a/gcc/rust/ast/rust-ast-dump.cc
+++ b/gcc/rust/ast/rust-ast-dump.cc
@@ -327,11 +327,57 @@ Dump::visit (ArithmeticOrLogicalExpr &expr)
void
Dump::visit (ComparisonExpr &expr)
-{}
+{
+ auto op = "";
+ switch (expr.get_expr_type ())
+ {
+ case ComparisonOperator::EQUAL:
+ op = "==";
+ break;
+ case ComparisonOperator::NOT_EQUAL:
+ op = "!=";
+ break;
+
+ case ComparisonOperator::GREATER_THAN:
+ op = ">";
+ break;
+
+ case ComparisonOperator::LESS_THAN:
+ op = "<";
+ break;
+
+ case ComparisonOperator::GREATER_OR_EQUAL:
+ op = ">=";
+ break;
+
+ case ComparisonOperator::LESS_OR_EQUAL:
+ op = "<=";
+ break;
+ }
+
+ expr.get_left_expr ()->accept_vis (*this);
+ stream << " " << op << " ";
+ expr.get_right_expr ()->accept_vis (*this);
+}
void
Dump::visit (LazyBooleanExpr &expr)
-{}
+{
+ auto op = "";
+ switch (expr.get_expr_type ())
+ {
+ case LazyBooleanOperator::LOGICAL_AND:
+ op = "&&";
+ break;
+ case LazyBooleanOperator::LOGICAL_OR:
+ op = "||";
+ break;
+ }
+
+ expr.get_left_expr ()->accept_vis (*this);
+ stream << " " << op << " ";
+ expr.get_right_expr ()->accept_vis (*this);
+}
void
Dump::visit (TypeCastExpr &expr)