diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2025-03-13 15:18:58 +0100 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2025-03-17 10:41:21 +0000 |
commit | 2472da2b128df45b0c9e4b8d3ec60eeb4732e6f1 (patch) | |
tree | 1158c34b45ffae5730459961c2584db6feb16fdd /gcc | |
parent | b3a065af7a2b99ee8bc93c881a7dd2a44b6c7d89 (diff) | |
download | gcc-2472da2b128df45b0c9e4b8d3ec60eeb4732e6f1.zip gcc-2472da2b128df45b0c9e4b8d3ec60eeb4732e6f1.tar.gz gcc-2472da2b128df45b0c9e4b8d3ec60eeb4732e6f1.tar.bz2 |
Remove finalize import visitor
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.patry@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/resolve/rust-finalize-imports-2.0.cc | 18 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-finalize-imports-2.0.h | 57 |
2 files changed, 0 insertions, 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 bd6002a..b0e8651 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 a06fe53..d587a5e 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 |