From: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com> This visitor is not used anymore.
gcc/rust/ChangeLog: * resolve/rust-finalize-imports-2.0.cc (FinalizeImports::FinalizeImports): Remove constructor. (FinalizeImports::go): Remove function. (FinalizeImports::visit): Likewise. * resolve/rust-finalize-imports-2.0.h (class FinalizeImports): Remove FinalizeImports class. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com> --- gcc/rust/resolve/rust-finalize-imports-2.0.cc | 18 ------ gcc/rust/resolve/rust-finalize-imports-2.0.h | 57 ------------------- 2 files changed, 75 deletions(-) diff --git a/gcc/rust/resolve/rust-finalize-imports-2.0.cc b/gcc/rust/resolve/rust-finalize-imports-2.0.cc index bd6002a09f4..b0e86512ac2 100644 --- a/gcc/rust/resolve/rust-finalize-imports-2.0.cc +++ b/gcc/rust/resolve/rust-finalize-imports-2.0.cc @@ -125,23 +125,5 @@ GlobbingVisitor::visit (AST::UseDeclaration &use) // Handle cycles ? } -FinalizeImports::FinalizeImports (Early::ImportMappings &&data, - TopLevel &toplevel, - NameResolutionContext &ctx) - : DefaultResolver (ctx), data (std::move (data)), toplevel (toplevel), - ctx (ctx) -{} - -void -FinalizeImports::go (AST::Crate &crate) -{ - for (auto &item : crate.items) - item->accept_vis (*this); -} - -void -FinalizeImports::visit (AST::UseDeclaration &use) -{} - } // namespace Resolver2_0 } // namespace Rust diff --git a/gcc/rust/resolve/rust-finalize-imports-2.0.h b/gcc/rust/resolve/rust-finalize-imports-2.0.h index a06fe538846..d587a5e5c46 100644 --- a/gcc/rust/resolve/rust-finalize-imports-2.0.h +++ b/gcc/rust/resolve/rust-finalize-imports-2.0.h @@ -49,62 +49,5 @@ private: NameResolutionContext &ctx; }; -// TODO: Fix documentation -// How do we do that? -// -// We want to resolve in the EarlyNameResolver, but we want to declare in the -// TopLevel Should the TopLevel declare stubs? How does rustc do it? How to do -// that for globbing? Should we do globbing afterwards once we've declared all -// the Uses*? -// -// Basically, for each use declare it in a separate map - in the -// EarlyNameResolver resolve and fix the ForeverStack? Emptying the maps each -// time? -// -// e.g. TopLevel builds a std::vector<NodeId, SimplePath> use_trees_to_resolve; -// Early goes through and resolves the SimplePath, then replaces the NodeId with -// the resolved one? Do we even need to do that? -// -// rustc just creates an empty definition for the use tree. -// -// What about globbing? std::vector<GlobbulesPath> globules; -// Early goes through and visits the module's path and calls the -// GlobbingVisitor? -// -// the file `imports.rs` goes through and *finalizes* imports. So we can -// probably add a FinalizeImport pass after the TopLevel and the Early. -// - TopLevel takes care of declaring these use trees -// - Early takes care of resolving them to definition points -// - Finalize takes care of mapping the use's definition point to the actual -// definition point -// - We need to work more on that last bit to know exactly what is being -// inserted, but probably it's going to mutate the ForeverStack - is that okay? -// - Oh actually maybe no! -// - TopLevel creates a map of UseTrees with paths to resolve. This should -// probably be an ImportKind enum or whatever -// - Early resolves them, creates a map of SimplePath with the associated -// definition: Map<ImportKind, ImportData> -// - Finalizes visits all UseTrees and inserts the Definitions found for -// each ImportKind - easy! -// - yay! - -class FinalizeImports : DefaultResolver -{ -public: - FinalizeImports (Early::ImportMappings &&data, TopLevel &toplevel, - NameResolutionContext &ctx); - - void go (AST::Crate &crate); - - void visit (AST::UseDeclaration &) override; - -private: - using AST::DefaultASTVisitor::visit; - - Early::ImportMappings data; - TopLevel &toplevel; - NameResolutionContext &ctx; -}; - } // namespace Resolver2_0 } // namespace Rust -- 2.45.2