diff options
author | Philip Herron <herron.philip@googlemail.com> | 2023-03-15 16:50:03 +0000 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2023-03-17 10:34:36 +0000 |
commit | 7334fb00e9cf2c8adfe2a197087652f5af451614 (patch) | |
tree | b194df9ff8d59efabc2a6766e882da0ce3c7dbfc /gcc | |
parent | 90a53011cb2b0ee9167e4bcedd753e1b7e615882 (diff) | |
download | gcc-7334fb00e9cf2c8adfe2a197087652f5af451614.zip gcc-7334fb00e9cf2c8adfe2a197087652f5af451614.tar.gz gcc-7334fb00e9cf2c8adfe2a197087652f5af451614.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 3c48607..0eeaac6 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)); } |