Globbing visitor did not visit subitems.
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add a check
for missing item.
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::go):
Add a new function in the visitor to dispatch the visitor to items in
the given module.
(TopLevel::handle_use_glob): Change call to visitor to use the pointer.
* resolve/rust-toplevel-name-resolver-2.0.h: Add prototype for new
member function.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
// do we emit it in `get<Namespace::Labels>`?
auto value = ctx.values.resolve_path (expr.get_segments ());
+ if (!value.has_value ())
+ rust_unreachable (); // Should have been resolved earlier
ctx.map_usage (Usage (expr.get_node_id ()), Definition (*value));
}
namespace Rust {
namespace Resolver2_0 {
+void
+GlobbingVisitor::go (AST::Module *module)
+{
+ for (auto &i : module->get_items ())
+ visit (i);
+}
+
void
GlobbingVisitor::visit (AST::Module &module)
{
return false;
GlobbingVisitor gvisitor (ctx);
- gvisitor.visit (*result.value ());
+ gvisitor.go (result.value ());
return true;
}
public:
GlobbingVisitor (NameResolutionContext &ctx) : ctx (ctx) {}
+ void go (AST::Module *module);
void visit (AST::Module &module) override;
void visit (AST::MacroRulesDefinition ¯o) override;
void visit (AST::Function &function) override;