From 5bc5d0122bf5f38ef394b9f3363995193c476530 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 23 Nov 2016 11:15:21 +0800 Subject: Resolve Index - Handle paths pointing to crate roots --- src/resolve/index.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/resolve') diff --git a/src/resolve/index.cpp b/src/resolve/index.cpp index c65327b0..71da3b4e 100644 --- a/src/resolve/index.cpp +++ b/src/resolve/index.cpp @@ -535,6 +535,10 @@ void Resolve_Index_Module_Normalise_Path_ext(const ::AST::Crate& crate, const Sp if( item_ptr->is_Import() ) { const auto& e = item_ptr->as_Import(); const auto& ec = crate.m_extern_crates.at( e.path.m_crate_name ); + if( e.path.m_components.size() == 0 ) { + hmod = &ec.m_hir->m_root_module; + continue ; + } item_ptr = &ec.m_hir->get_typeitem_by_path(sp, e.path, true); // ignore_crate_name=true } TU_MATCH_DEF(::HIR::TypeItem, (*item_ptr), (e), -- cgit v1.2.3