From 85d8754632d597fe3d94404406082bcbb2f5ff94 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Tue, 19 Jan 2021 17:02:45 +0000 Subject: Implement NegationExpression This is an example of a unary expression in gimple. The rules for enforcing the types are observed in the type resolver here too. Unary negate cannot be applied to bools but only integers and floats. Unary not cannot be applied to floating points but can be applied to integers and bools. --- gcc/rust/resolve/rust-ast-resolve-expr.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/rust/resolve') diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.h b/gcc/rust/resolve/rust-ast-resolve-expr.h index 181124a..03b3496 100644 --- a/gcc/rust/resolve/rust-ast-resolve-expr.h +++ b/gcc/rust/resolve/rust-ast-resolve-expr.h @@ -128,6 +128,11 @@ public: ResolveExpr::go (expr.get_right_expr ().get (), expr.get_node_id ()); } + void visit (AST::NegationExpr &expr) + { + ResolveExpr::go (expr.get_negated_expr ().get (), expr.get_node_id ()); + } + void visit (AST::IfExpr &expr) { ResolveExpr::go (expr.get_condition_expr ().get (), expr.get_node_id ()); -- cgit v1.1