aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-01-19 17:02:45 +0000
committerPhilip Herron <herron.philip@googlemail.com>2021-01-20 10:03:50 +0000
commit85d8754632d597fe3d94404406082bcbb2f5ff94 (patch)
treea118c7d4e6c294fb2b775da8fb75efad6227b0f0 /gcc/rust/resolve
parent6e09093f1f759a78387d214b6d0fe8ba17b752b6 (diff)
downloadgcc-85d8754632d597fe3d94404406082bcbb2f5ff94.zip
gcc-85d8754632d597fe3d94404406082bcbb2f5ff94.tar.gz
gcc-85d8754632d597fe3d94404406082bcbb2f5ff94.tar.bz2
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.
Diffstat (limited to 'gcc/rust/resolve')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-expr.h5
1 files changed, 5 insertions, 0 deletions
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 ());