diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-06-27 13:07:42 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-06-27 13:07:42 +0100 |
commit | 1ea95c3548ce17a4a3604dfc5e2e6661750e5a85 (patch) | |
tree | 50b4406d9f51d9e96c21c18f56a931deeed928ae /gcc/rust/resolve/rust-ast-resolve.cc | |
parent | c31bffa99b1a7007572637228bd99c00362ae597 (diff) | |
download | gcc-1ea95c3548ce17a4a3604dfc5e2e6661750e5a85.zip gcc-1ea95c3548ce17a4a3604dfc5e2e6661750e5a85.tar.gz gcc-1ea95c3548ce17a4a3604dfc5e2e6661750e5a85.tar.bz2 |
refactor relative type path function into its assoicated file
Diffstat (limited to 'gcc/rust/resolve/rust-ast-resolve.cc')
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve.cc | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve.cc b/gcc/rust/resolve/rust-ast-resolve.cc index ff042bc..93fa7c8 100644 --- a/gcc/rust/resolve/rust-ast-resolve.cc +++ b/gcc/rust/resolve/rust-ast-resolve.cc @@ -111,53 +111,5 @@ NameResolution::go (AST::Crate &crate) resolver->pop_module_scope (); } -// qualified path in type - -bool -ResolveRelativeTypePath::resolve_qual_seg (AST::QualifiedPathType &seg, - CanonicalPath &result) -{ - if (seg.is_error ()) - { - rust_error_at (seg.get_locus (), "segment has error: %s", - seg.as_string ().c_str ()); - return false; - } - - auto type = seg.get_type ().get (); - NodeId type_resolved_node = ResolveType::go (type, seg.get_node_id ()); - if (type_resolved_node == UNKNOWN_NODEID) - return false; - - const CanonicalPath *impl_type_seg = nullptr; - bool ok - = mappings->lookup_canonical_path (mappings->get_current_crate (), - type_resolved_node, &impl_type_seg); - rust_assert (ok); - - if (!seg.has_as_clause ()) - { - result = result.append (*impl_type_seg); - return true; - } - - NodeId trait_resolved_node - = ResolveType::go (&seg.get_as_type_path (), seg.get_node_id ()); - if (trait_resolved_node == UNKNOWN_NODEID) - return false; - - const CanonicalPath *trait_type_seg = nullptr; - ok = mappings->lookup_canonical_path (mappings->get_current_crate (), - trait_resolved_node, &trait_type_seg); - rust_assert (ok); - - CanonicalPath projection - = TraitImplProjection::resolve (seg.get_node_id (), *trait_type_seg, - *impl_type_seg); - - result = result.append (projection); - return true; -} - } // namespace Resolver } // namespace Rust |