summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-18 08:59:41 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-18 08:59:59 +0800
commit48e99abaf3e22bb95d322f527f4cf154e9ccef66 (patch)
treec7cea98f62bca632e52430b46a9c2bd6b8caa62b
parent6511ff4ec666f5bb040d07df85dbd4b02d9c9f0b (diff)
downloadmrust-48e99abaf3e22bb95d322f527f4cf154e9ccef66.tar.gz
AST - Load referenced crates in anon modules
-rw-r--r--src/ast/crate.cpp4
-rw-r--r--src/resolve/index.cpp1
2 files changed, 5 insertions, 0 deletions
diff --git a/src/ast/crate.cpp b/src/ast/crate.cpp
index c05b2e29..5b15a15d 100644
--- a/src/ast/crate.cpp
+++ b/src/ast/crate.cpp
@@ -29,6 +29,10 @@ namespace {
}
)
}
+ // TODO: What about if an anon mod has been #[cfg]-d out?
+ for(const auto& anon : mod.anon_mods() ) {
+ iterate_module(*anon, fcn);
+ }
}
}
diff --git a/src/resolve/index.cpp b/src/resolve/index.cpp
index 421f4ae1..39ae4ff2 100644
--- a/src/resolve/index.cpp
+++ b/src/resolve/index.cpp
@@ -122,6 +122,7 @@ void Resolve_Index_Module_Base(const AST::Crate& crate, AST::Module& mod)
_add_item(i.data.span, mod, IndexName::Namespace, i.name, i.is_pub, mv$(p));
),
(Crate,
+ ASSERT_BUG(i.data.span, crate.m_extern_crates.count(e.name) > 0, "Referenced crate '" << e.name << "' isn't loaded");
p.bind( ::AST::PathBinding::make_Crate({ &crate.m_extern_crates.at(e.name) }) );
_add_item(i.data.span, mod, IndexName::Namespace, i.name, i.is_pub, mv$(p));
),