aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
diff options
context:
space:
mode:
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.cc11
1 files changed, 11 insertions, 0 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 c4dfdb2..9a56145 100644
--- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
@@ -76,6 +76,17 @@ TopLevel::visit (AST::Module &module)
{
insert_or_error_out (module.get_name (), module, Namespace::Types);
+ // Parse the module's items if they haven't been expanded and the file
+ // should be parsed (i.e isn't hidden behind an untrue or impossible cfg
+ // directive
+ // TODO: make sure this is right
+ // TODO: avoid loading items if cfg attributes are present?
+ // might not be needed if this runs after early resolution?
+ // This was copied from the old early resolver method
+ // 'accumulate_escaped_macros'
+ if (module.get_kind () == AST::Module::UNLOADED)
+ module.load_items ();
+
auto sub_visitor = [this, &module] () {
for (auto &item : module.get_items ())
item->accept_vis (*this);