diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-09-09 19:13:48 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-09-09 19:13:48 +0800 |
commit | 7ba5a2f03ccf6ecec0c6a2e85b2ad7f9790e9b88 (patch) | |
tree | ba024abd4ad19f3bdd120b86fa252938701e79ef | |
parent | d901720596a87127b1388288c51354cb2a0966e5 (diff) | |
download | mrust-7ba5a2f03ccf6ecec0c6a2e85b2ad7f9790e9b88.tar.gz |
Resolve - Handle glob improt of root
-rw-r--r-- | src/resolve/use.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/resolve/use.cpp b/src/resolve/use.cpp index c4d32a6f..ca067304 100644 --- a/src/resolve/use.cpp +++ b/src/resolve/use.cpp @@ -702,13 +702,18 @@ namespace { const AST::Module* mod = &crate.m_root_module; const auto& nodes = path.nodes(); + if( nodes.size() == 0 ) { + // An import of the root. + return ::AST::PathBinding::make_Module({ mod, nullptr }); + } for( unsigned int i = 0; i < nodes.size()-1; i ++ ) { // TODO: If this came from an import, return the real path? //rv = Resolve_Use_CanoniseAndBind_Mod(span, crate, *mod, mv$(rv), nodes[i].name(), parent_modules, Lookup::Type); //const auto& b = rv.binding(); - auto b = Resolve_Use_GetBinding_Mod(span, crate, *mod, nodes[i].name(), parent_modules, Lookup::Type); + assert(mod); + auto b = Resolve_Use_GetBinding_Mod(span, crate, *mod, nodes.at(i).name(), parent_modules, Lookup::Type); TU_MATCH_DEF(::AST::PathBinding, (b), (e), ( ERROR(span, E0000, "Unexpected item type " << b.tag_str() << " in import of " << path); |