diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2023-10-11 15:02:38 -0400 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 19:09:22 +0100 |
commit | 124bfaf4323f627bd7721401c3a86f369f45a1b2 (patch) | |
tree | 4aae34af40547591885e7b613fb855979eb5bdf6 | |
parent | 4331ce6917af68576a28b4f1d831948c579b36f6 (diff) | |
download | gcc-124bfaf4323f627bd7721401c3a86f369f45a1b2.zip gcc-124bfaf4323f627bd7721401c3a86f369f45a1b2.tar.gz gcc-124bfaf4323f627bd7721401c3a86f369f45a1b2.tar.bz2 |
gccrs: Make lowering of AssociatedItem instances polymorphic
gcc/rust/ChangeLog:
* hir/rust-ast-lower-implitem.h
(ASTLoweringImplItem::translate): Take AssociatedItem as parameter.
(ASTLoweringTraitItem::translate): Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-implitem.h | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-implitem.h b/gcc/rust/hir/rust-ast-lower-implitem.h index 9aef2cb..91c9470 100644 --- a/gcc/rust/hir/rust-ast-lower-implitem.h +++ b/gcc/rust/hir/rust-ast-lower-implitem.h @@ -32,31 +32,7 @@ class ASTLowerImplItem : public ASTLoweringBase using Rust::HIR::ASTLoweringBase::visit; public: - static HIR::ImplItem *translate (AST::InherentImplItem *item, - HirId parent_impl_id) - { - ASTLowerImplItem resolver; - item->accept_vis (resolver); - - if (resolver.translated != nullptr) - { - rust_assert (resolver.item_cast != nullptr); - - auto id = resolver.translated->get_impl_mappings ().get_hirid (); - auto defid = resolver.translated->get_impl_mappings ().get_defid (); - auto locus = resolver.translated->get_locus (); - - resolver.handle_outer_attributes (*resolver.item_cast); - resolver.mappings->insert_hir_implitem (parent_impl_id, - resolver.translated); - resolver.mappings->insert_location (id, locus); - resolver.mappings->insert_defid_mapping (defid, resolver.item_cast); - } - - return resolver.translated; - } - - static HIR::ImplItem *translate (AST::TraitImplItem *item, + static HIR::ImplItem *translate (AST::AssociatedItem *item, HirId parent_impl_id) { ASTLowerImplItem resolver; @@ -312,7 +288,7 @@ class ASTLowerTraitItem : public ASTLoweringBase using Rust::HIR::ASTLoweringBase::visit; public: - static HIR::TraitItem *translate (AST::TraitItem *item) + static HIR::TraitItem *translate (AST::AssociatedItem *item) { ASTLowerTraitItem resolver; item->accept_vis (resolver); |