Skip to content

Commit 2472da2

Browse files
committed
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 <[email protected]>
1 parent b3a065a commit 2472da2

File tree

2 files changed

+0
-75
lines changed

2 files changed

+0
-75
lines changed

gcc/rust/resolve/rust-finalize-imports-2.0.cc

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,5 @@ GlobbingVisitor::visit (AST::UseDeclaration &use)
125125
// Handle cycles ?
126126
}
127127

128-
FinalizeImports::FinalizeImports (Early::ImportMappings &&data,
129-
TopLevel &toplevel,
130-
NameResolutionContext &ctx)
131-
: DefaultResolver (ctx), data (std::move (data)), toplevel (toplevel),
132-
ctx (ctx)
133-
{}
134-
135-
void
136-
FinalizeImports::go (AST::Crate &crate)
137-
{
138-
for (auto &item : crate.items)
139-
item->accept_vis (*this);
140-
}
141-
142-
void
143-
FinalizeImports::visit (AST::UseDeclaration &use)
144-
{}
145-
146128
} // namespace Resolver2_0
147129
} // namespace Rust

gcc/rust/resolve/rust-finalize-imports-2.0.h

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -49,62 +49,5 @@ class GlobbingVisitor : public AST::DefaultASTVisitor
4949
NameResolutionContext &ctx;
5050
};
5151

52-
// TODO: Fix documentation
53-
// How do we do that?
54-
//
55-
// We want to resolve in the EarlyNameResolver, but we want to declare in the
56-
// TopLevel Should the TopLevel declare stubs? How does rustc do it? How to do
57-
// that for globbing? Should we do globbing afterwards once we've declared all
58-
// the Uses*?
59-
//
60-
// Basically, for each use declare it in a separate map - in the
61-
// EarlyNameResolver resolve and fix the ForeverStack? Emptying the maps each
62-
// time?
63-
//
64-
// e.g. TopLevel builds a std::vector<NodeId, SimplePath> use_trees_to_resolve;
65-
// Early goes through and resolves the SimplePath, then replaces the NodeId with
66-
// the resolved one? Do we even need to do that?
67-
//
68-
// rustc just creates an empty definition for the use tree.
69-
//
70-
// What about globbing? std::vector<GlobbulesPath> globules;
71-
// Early goes through and visits the module's path and calls the
72-
// GlobbingVisitor?
73-
//
74-
// the file `imports.rs` goes through and *finalizes* imports. So we can
75-
// probably add a FinalizeImport pass after the TopLevel and the Early.
76-
// - TopLevel takes care of declaring these use trees
77-
// - Early takes care of resolving them to definition points
78-
// - Finalize takes care of mapping the use's definition point to the actual
79-
// definition point
80-
// - We need to work more on that last bit to know exactly what is being
81-
// inserted, but probably it's going to mutate the ForeverStack - is that okay?
82-
// - Oh actually maybe no!
83-
// - TopLevel creates a map of UseTrees with paths to resolve. This should
84-
// probably be an ImportKind enum or whatever
85-
// - Early resolves them, creates a map of SimplePath with the associated
86-
// definition: Map<ImportKind, ImportData>
87-
// - Finalizes visits all UseTrees and inserts the Definitions found for
88-
// each ImportKind - easy!
89-
// - yay!
90-
91-
class FinalizeImports : DefaultResolver
92-
{
93-
public:
94-
FinalizeImports (Early::ImportMappings &&data, TopLevel &toplevel,
95-
NameResolutionContext &ctx);
96-
97-
void go (AST::Crate &crate);
98-
99-
void visit (AST::UseDeclaration &) override;
100-
101-
private:
102-
using AST::DefaultASTVisitor::visit;
103-
104-
Early::ImportMappings data;
105-
TopLevel &toplevel;
106-
NameResolutionContext &ctx;
107-
};
108-
10952
} // namespace Resolver2_0
11053
} // namespace Rust

0 commit comments

Comments
 (0)