diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-04-04 15:42:29 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-19 15:32:12 +0100 |
commit | 8ed0cc70f73ab88218e587977cc0c181eb58453e (patch) | |
tree | 8f71888dc6fb1e661965286cd8a30dfdb9fb3562 /gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc | |
parent | ca285a61c35df7da6ff652a2b2fbba8eef7d246b (diff) | |
download | gcc-8ed0cc70f73ab88218e587977cc0c181eb58453e.zip gcc-8ed0cc70f73ab88218e587977cc0c181eb58453e.tar.gz gcc-8ed0cc70f73ab88218e587977cc0c181eb58453e.tar.bz2 |
gccrs: toplevel: Build list of imports for Early to resolve
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc: Comment out handle_use
call and error emission.
* resolve/rust-toplevel-name-resolver-2.0.h: Create ImportKind class.
Diffstat (limited to 'gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc')
-rw-r--r-- | gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc index b18b86c..3ce1630 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc @@ -749,21 +749,28 @@ TopLevel::visit (AST::UseDeclaration &use) const auto &tree = use.get_tree (); flatten (tree.get (), paths, glob_path, rebind_path, this->ctx); - for (auto &path : paths) - if (!handle_use_dec (path)) - rust_error_at (path.get_final_segment ().get_locus (), ErrorCode::E0433, - "unresolved import %qs", path.as_string ().c_str ()); - - for (auto &glob : glob_path) - if (!handle_use_glob (glob)) - rust_error_at (glob.get_final_segment ().get_locus (), ErrorCode::E0433, - "unresolved import %qs", glob.as_string ().c_str ()); - - for (auto &rebind : rebind_path) - if (!handle_rebind (rebind)) - rust_error_at (rebind.first.get_final_segment ().get_locus (), - ErrorCode::E0433, "unresolved import %qs", - rebind.first.as_string ().c_str ()); + for (auto &&path : paths) + imports_to_resolve.emplace_back (ImportKind::Simple (std::move (path))); + + // if (!handle_use_dec (path)) + // rust_error_at (path.get_final_segment ().get_locus (), ErrorCode::E0433, + // "unresolved import %qs", path.as_string ().c_str ()); + + for (auto &&glob : glob_path) + imports_to_resolve.emplace_back (ImportKind::Glob (std::move (glob))); + + // if (!handle_use_glob (glob)) + // rust_error_at (glob.get_final_segment ().get_locus (), ErrorCode::E0433, + // "unresolved import %qs", glob.as_string ().c_str ()); + + for (auto &&rebind : rebind_path) + imports_to_resolve.emplace_back ( + ImportKind::Rebind (std::move (rebind.first), std::move (rebind.second))); + + // if (!handle_rebind (rebind)) + // rust_error_at (rebind.first.get_final_segment ().get_locus (), + // ErrorCode::E0433, "unresolved import %qs", + // rebind.first.as_string ().c_str ()); } } // namespace Resolver2_0 |