aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-06-28 11:01:15 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-06-28 11:01:15 +0100
commit964969d4c608b058f37fafaef5e7f0f9ab7aef83 (patch)
tree7720318c721a14f7a800b8e4635da1f6e53043ff /gcc
parent64832f0c5dd60eae3539e2fe73d72c78fbb22d46 (diff)
downloadgcc-964969d4c608b058f37fafaef5e7f0f9ab7aef83.zip
gcc-964969d4c608b058f37fafaef5e7f0f9ab7aef83.tar.gz
gcc-964969d4c608b058f37fafaef5e7f0f9ab7aef83.tar.bz2
refactor class helper to create trait impl path segments into the CanonicalPath class itself
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-item.cc9
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-toplevel.h5
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-type.cc5
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-type.h11
-rw-r--r--gcc/rust/util/rust-canonical-path.h8
5 files changed, 19 insertions, 19 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-item.cc b/gcc/rust/resolve/rust-ast-resolve-item.cc
index 0c9536f..222da03 100644
--- a/gcc/rust/resolve/rust-ast-resolve-item.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-item.cc
@@ -775,14 +775,15 @@ ResolveItem::visit (AST::TraitImpl &impl_block)
type_resolve_generic_args);
CanonicalPath projection
- = TraitImplProjection::resolve (impl_block.get_node_id (), trait_type_seg,
- impl_type_seg);
+ = CanonicalPath::trait_impl_projection_seg (impl_block.get_node_id (),
+ trait_type_seg, impl_type_seg);
CanonicalPath impl_prefix = prefix.append (projection);
// setup canonical-path
CanonicalPath canonical_projection
- = TraitImplProjection::resolve (impl_block.get_node_id (),
- canonical_trait_type, canonical_impl_type);
+ = CanonicalPath::trait_impl_projection_seg (impl_block.get_node_id (),
+ canonical_trait_type,
+ canonical_impl_type);
CanonicalPath cpath = CanonicalPath::create_empty ();
if (canonical_prefix.size () <= 1)
{
diff --git a/gcc/rust/resolve/rust-ast-resolve-toplevel.h b/gcc/rust/resolve/rust-ast-resolve-toplevel.h
index aed8565..15f5af7 100644
--- a/gcc/rust/resolve/rust-ast-resolve-toplevel.h
+++ b/gcc/rust/resolve/rust-ast-resolve-toplevel.h
@@ -355,8 +355,9 @@ public:
type_resolve_generic_args);
CanonicalPath projection
- = TraitImplProjection::resolve (impl_block.get_node_id (), trait_type_seg,
- impl_type_seg);
+ = CanonicalPath::trait_impl_projection_seg (impl_block.get_node_id (),
+ trait_type_seg,
+ impl_type_seg);
CanonicalPath impl_prefix = prefix.append (projection);
resolver->get_name_scope ().insert (
diff --git a/gcc/rust/resolve/rust-ast-resolve-type.cc b/gcc/rust/resolve/rust-ast-resolve-type.cc
index 553008d..c5fe325 100644
--- a/gcc/rust/resolve/rust-ast-resolve-type.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-type.cc
@@ -479,8 +479,9 @@ ResolveRelativeTypePath::resolve_qual_seg (AST::QualifiedPathType &seg,
rust_assert (ok);
CanonicalPath projection
- = TraitImplProjection::resolve (seg.get_node_id (), *trait_type_seg,
- *impl_type_seg);
+ = CanonicalPath::trait_impl_projection_seg (seg.get_node_id (),
+ *trait_type_seg,
+ *impl_type_seg);
result = result.append (projection);
return true;
diff --git a/gcc/rust/resolve/rust-ast-resolve-type.h b/gcc/rust/resolve/rust-ast-resolve-type.h
index f7e17b0..8f52c3e 100644
--- a/gcc/rust/resolve/rust-ast-resolve-type.h
+++ b/gcc/rust/resolve/rust-ast-resolve-type.h
@@ -79,17 +79,6 @@ protected:
bool failure_flag;
};
-class TraitImplProjection
-{
-public:
- static CanonicalPath resolve (NodeId id, const CanonicalPath &trait_seg,
- const CanonicalPath &impl_type_seg)
- {
- return CanonicalPath::new_seg (id, "<" + impl_type_seg.get () + " as "
- + trait_seg.get () + ">");
- }
-};
-
class ResolveRelativeTypePath : public ResolveTypeToCanonicalPath
{
using ResolveTypeToCanonicalPath::visit;
diff --git a/gcc/rust/util/rust-canonical-path.h b/gcc/rust/util/rust-canonical-path.h
index 9b34075..54cc039 100644
--- a/gcc/rust/util/rust-canonical-path.h
+++ b/gcc/rust/util/rust-canonical-path.h
@@ -61,6 +61,14 @@ public:
UNKNOWN_CREATENUM);
}
+ static CanonicalPath
+ trait_impl_projection_seg (NodeId id, const CanonicalPath &trait_seg,
+ const CanonicalPath &impl_type_seg)
+ {
+ return CanonicalPath::new_seg (id, "<" + impl_type_seg.get () + " as "
+ + trait_seg.get () + ">");
+ }
+
std::string get () const
{
std::string buf;