aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-pattern.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/backend/rust-compile-pattern.cc')
-rw-r--r--gcc/rust/backend/rust-compile-pattern.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-pattern.cc b/gcc/rust/backend/rust-compile-pattern.cc
index 393fbd5..e8f1c51 100644
--- a/gcc/rust/backend/rust-compile-pattern.cc
+++ b/gcc/rust/backend/rust-compile-pattern.cc
@@ -80,6 +80,20 @@ CompilePatternCaseLabelExpr::visit (HIR::WildcardPattern &pattern)
= build_case_label (NULL_TREE, NULL_TREE, associated_case_label);
}
+void
+CompilePatternCaseLabelExpr::visit (HIR::LiteralPattern &pattern)
+{
+ // Compile the literal
+ HIR::LiteralExpr *litexpr
+ = new HIR::LiteralExpr (pattern.get_pattern_mappings (),
+ pattern.get_literal (), pattern.get_locus (),
+ std::vector<AST::Attribute> ());
+
+ tree lit = CompileExpr::Compile (litexpr, ctx);
+
+ case_label_expr = build_case_label (lit, NULL_TREE, associated_case_label);
+}
+
// setup the bindings
void