public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] Add HIR lowering for GroupedPattern Date: Thu, 26 Jan 2023 07:27:17 +0000 (GMT) [thread overview] Message-ID: <20230126072717.F3C203858C50@sourceware.org> (raw) https://gcc.gnu.org/g:ea7893625e8246b85da4d3aa0fef40f82d619873 commit ea7893625e8246b85da4d3aa0fef40f82d619873 Author: Owen Avery <powerboat9.gamer@gmail.com> Date: Wed Jan 11 11:54:54 2023 -0500 Add HIR lowering for GroupedPattern Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com> Diff: --- gcc/rust/hir/rust-ast-lower-pattern.cc | 16 ++++++++++++++++ gcc/rust/hir/rust-ast-lower-pattern.h | 1 + 2 files changed, 17 insertions(+) diff --git a/gcc/rust/hir/rust-ast-lower-pattern.cc b/gcc/rust/hir/rust-ast-lower-pattern.cc index 2c9a0dc59a1..d13af46523b 100644 --- a/gcc/rust/hir/rust-ast-lower-pattern.cc +++ b/gcc/rust/hir/rust-ast-lower-pattern.cc @@ -243,5 +243,21 @@ ASTLoweringPattern::visit (AST::RangePattern &pattern) std::move (upper_bound), pattern.get_locus ()); } +void +ASTLoweringPattern::visit (AST::GroupedPattern &pattern) +{ + auto crate_num = mappings->get_current_crate (); + Analysis::NodeMapping mapping (crate_num, pattern.get_node_id (), + mappings->get_next_hir_id (crate_num), + UNKNOWN_LOCAL_DEFID); + + HIR::Pattern *inner + = ASTLoweringPattern::translate (pattern.get_pattern_in_parens ().get ()); + + translated + = new HIR::GroupedPattern (mapping, std::unique_ptr<HIR::Pattern> (inner), + pattern.get_locus ()); +} + } // namespace HIR } // namespace Rust diff --git a/gcc/rust/hir/rust-ast-lower-pattern.h b/gcc/rust/hir/rust-ast-lower-pattern.h index 4ab81a856a7..20a5529d856 100644 --- a/gcc/rust/hir/rust-ast-lower-pattern.h +++ b/gcc/rust/hir/rust-ast-lower-pattern.h @@ -39,6 +39,7 @@ public: void visit (AST::TuplePattern &pattern) override; void visit (AST::LiteralPattern &pattern) override; void visit (AST::RangePattern &pattern) override; + void visit (AST::GroupedPattern &pattern) override; private: ASTLoweringPattern ();
reply other threads:[~2023-01-26 7:27 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230126072717.F3C203858C50@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).