diff options
author | Philip Herron <herron.philip@googlemail.com> | 2023-03-15 16:50:03 +0000 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:21:12 +0100 |
commit | dc92981d06a8695bf589a1fcfda427a38265ebee (patch) | |
tree | aff8df7dce89e8bfc1275802ea5cf91793b77f18 /gcc | |
parent | ac01179b4711efd702a9582fc142f584f660f588 (diff) | |
download | gcc-dc92981d06a8695bf589a1fcfda427a38265ebee.zip gcc-dc92981d06a8695bf589a1fcfda427a38265ebee.tar.gz gcc-dc92981d06a8695bf589a1fcfda427a38265ebee.tar.bz2 |
gccrs: remove proxy class to use virtual method to get impl_item name
gcc/rust/ChangeLog:
* typecheck/rust-hir-inherent-impl-overlap.h (class ImplItemToName): remove
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/typecheck/rust-hir-inherent-impl-overlap.h | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/gcc/rust/typecheck/rust-hir-inherent-impl-overlap.h b/gcc/rust/typecheck/rust-hir-inherent-impl-overlap.h index c6db896..6ab5dc0 100644 --- a/gcc/rust/typecheck/rust-hir-inherent-impl-overlap.h +++ b/gcc/rust/typecheck/rust-hir-inherent-impl-overlap.h @@ -25,43 +25,6 @@ namespace Rust { namespace Resolver { -class ImplItemToName : private TypeCheckBase, private HIR::HIRImplVisitor -{ -public: - static bool resolve (HIR::ImplItem *item, std::string &name_result) - { - ImplItemToName resolver (name_result); - item->accept_vis (resolver); - return resolver.ok; - } - - void visit (HIR::TypeAlias &alias) override - { - ok = true; - result.assign (alias.get_new_type_name ()); - } - - void visit (HIR::Function &function) override - { - ok = true; - result.assign (function.get_function_name ()); - } - - void visit (HIR::ConstantItem &constant) override - { - ok = true; - result.assign (constant.get_identifier ()); - } - -private: - ImplItemToName (std::string &result) - : TypeCheckBase (), ok (false), result (result) - {} - - bool ok; - std::string &result; -}; - class OverlappingImplItemPass : public TypeCheckBase { public: @@ -97,10 +60,7 @@ public: if (!ok) return; - std::string impl_item_name; - ok = ImplItemToName::resolve (impl_item, impl_item_name); - rust_assert (ok); - + std::string impl_item_name = impl_item->get_impl_item_name (); std::pair<HIR::ImplItem *, std::string> elem (impl_item, impl_item_name); impl_mappings[impl_type].insert (std::move (elem)); } |