aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-expr.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-12-14 21:11:04 +0000
committerPhilip Herron <philip.herron@embecosm.com>2021-12-18 20:20:49 +0000
commit52ee02f4012d0d5d4363ebb4e71e57b053acf072 (patch)
tree0cfaf806ac4ef1afbd32014133611c6e4cbf3305 /gcc/rust/backend/rust-compile-expr.h
parenta8a345642a2a150a35b68e2f19b90abf105700c5 (diff)
downloadgcc-52ee02f4012d0d5d4363ebb4e71e57b053acf072.zip
gcc-52ee02f4012d0d5d4363ebb4e71e57b053acf072.tar.gz
gcc-52ee02f4012d0d5d4363ebb4e71e57b053acf072.tar.bz2
Add support for enums on the match expression
This is our initial first pass of adding support for the MatchExpr though two things stand out here. We need to switch over to using a GCC enumeral type for the union qualifier so we get advantage of the GCC code to ensure all variants are being addressed. We also need to fix out enum type to get better gdb support which might be simply chaning over to the qual_union_type. Fixes #190
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.h')
-rw-r--r--gcc/rust/backend/rust-compile-expr.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h
index 9895540..dc4f909 100644
--- a/gcc/rust/backend/rust-compile-expr.h
+++ b/gcc/rust/backend/rust-compile-expr.h
@@ -221,6 +221,10 @@ public:
translated
= ctx->get_backend ()->var_expression (var, expr.get_locus ());
}
+ else if (ctx->lookup_pattern_binding (ref, &translated))
+ {
+ return;
+ }
else
{
rust_fatal_error (expr.get_locus (),
@@ -1043,6 +1047,8 @@ public:
void visit (HIR::DereferenceExpr &expr) override;
+ void visit (HIR::MatchExpr &expr) override;
+
protected:
tree compile_dyn_dispatch_call (const TyTy::DynamicObjectType *dyn,
TyTy::BaseType *receiver,