From 221650c280c4a02ff472436a32bb267c7b5f8d22 Mon Sep 17 00:00:00 2001 From: Owen Avery Date: Wed, 11 Jan 2023 11:57:28 -0500 Subject: [PATCH] gccrs: Added missing GroupedPattern visitors for code generation gcc/rust/ChangeLog: * backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Add proper visitor. (CompilePatternBindings::visit): Likewise. * backend/rust-compile-pattern.h: Declare them. Signed-off-by: Owen Avery --- gcc/rust/backend/rust-compile-pattern.cc | 12 ++++++++++++ gcc/rust/backend/rust-compile-pattern.h | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gcc/rust/backend/rust-compile-pattern.cc b/gcc/rust/backend/rust-compile-pattern.cc index fc70d4b..9218b81 100644 --- a/gcc/rust/backend/rust-compile-pattern.cc +++ b/gcc/rust/backend/rust-compile-pattern.cc @@ -161,6 +161,12 @@ CompilePatternCaseLabelExpr::visit (HIR::RangePattern &pattern) case_label_expr = build_case_label (lower, upper, associated_case_label); } +void +CompilePatternCaseLabelExpr::visit (HIR::GroupedPattern &pattern) +{ + pattern.get_item ()->accept_vis (*this); +} + // setup the bindings void @@ -329,5 +335,11 @@ CompilePatternBindings::visit (HIR::StructPattern &pattern) } } +void +CompilePatternBindings::visit (HIR::GroupedPattern &pattern) +{ + pattern.get_item ()->accept_vis (*this); +} + } // namespace Compile } // namespace Rust diff --git a/gcc/rust/backend/rust-compile-pattern.h b/gcc/rust/backend/rust-compile-pattern.h index 22812a4..43334af 100644 --- a/gcc/rust/backend/rust-compile-pattern.h +++ b/gcc/rust/backend/rust-compile-pattern.h @@ -38,9 +38,9 @@ public: void visit (HIR::TupleStructPattern &pattern) override; void visit (HIR::WildcardPattern &pattern) override; void visit (HIR::RangePattern &pattern) override; + void visit (HIR::GroupedPattern &pattern) override; // Empty visit for unused Pattern HIR nodes. - void visit (HIR::GroupedPattern &) override {} void visit (HIR::IdentifierPattern &) override {} void visit (HIR::LiteralPattern &) override; void visit (HIR::QualifiedPathInExpression &) override {} @@ -70,9 +70,9 @@ public: void visit (HIR::StructPattern &pattern) override; void visit (HIR::TupleStructPattern &pattern) override; + void visit (HIR::GroupedPattern &) override; // Empty visit for unused Pattern HIR nodes. - void visit (HIR::GroupedPattern &) override {} void visit (HIR::IdentifierPattern &) override {} void visit (HIR::LiteralPattern &) override {} void visit (HIR::PathInExpression &) override {} -- 2.7.4