diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ast/crate.cpp | 9 | ||||
-rw-r--r-- | src/hir/serialise.cpp | 3 | ||||
-rw-r--r-- | src/resolve/use.cpp | 4 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/ast/crate.cpp b/src/ast/crate.cpp index c9856781..6abe6d59 100644 --- a/src/ast/crate.cpp +++ b/src/ast/crate.cpp @@ -111,7 +111,7 @@ void Crate::load_externs() // - Crates recorded in rlibs should specify a hash/tag that's passed in to this function. RcString Crate::load_extern_crate(Span sp, const RcString& name, const ::std::string& basename/*=""*/) { - DEBUG("Loading crate '" << name << "'"); + TRACE_FUNCTION_F("Loading crate '" << name << "' (basename='" << basename << "')"); ::std::string path; auto it = g_crate_overrides.find(name.c_str()); @@ -121,9 +121,13 @@ RcString Crate::load_extern_crate(Span sp, const RcString& name, const ::std::st if( !::std::ifstream(path).good() ) { ERROR(sp, E0000, "Unable to open crate '" << name << "' at path " << path); } + DEBUG("path = " << path << " (--extern)"); } else if( basename != "" ) { +#if 1 + path = basename; +#else // Search a list of load paths for the crate for(const auto& p : g_crate_load_dirs) { @@ -133,9 +137,11 @@ RcString Crate::load_extern_crate(Span sp, const RcString& name, const ::std::st break ; } } +#endif if( !::std::ifstream(path).good() ) { ERROR(sp, E0000, "Unable to locate crate '" << name << "' with filename " << basename << " in search directories"); } + DEBUG("path = " << path << " (basename)"); } else { @@ -183,6 +189,7 @@ RcString Crate::load_extern_crate(Span sp, const RcString& name, const ::std::st ERROR(sp, E0000, "Unable to locate crate '" << name << "' in search directories"); } path = paths.front(); + DEBUG("path = " << path << " (search)"); } // NOTE: Creating `ExternCrate` loads the crate from the specified path diff --git a/src/hir/serialise.cpp b/src/hir/serialise.cpp index 7725d49f..272e176f 100644 --- a/src/hir/serialise.cpp +++ b/src/hir/serialise.cpp @@ -342,7 +342,8 @@ for(const auto& ext : crate.m_ext_crates) { m_out.write_string(ext.first); - m_out.write_string(ext.second.m_basename); + //m_out.write_string(ext.second.m_basename); + m_out.write_string(ext.second.m_path); } serialise_vec(crate.m_ext_libs); serialise_vec(crate.m_link_paths); diff --git a/src/resolve/use.cpp b/src/resolve/use.cpp index cde9cd5f..64b673ce 100644 --- a/src/resolve/use.cpp +++ b/src/resolve/use.cpp @@ -541,11 +541,12 @@ namespace { ::AST::Path::Bindings Resolve_Use_GetBinding__ext(const Span& span, const ::AST::Crate& crate, const ::AST::Path& path, const ::HIR::Module& hmodr, unsigned int start) { ::AST::Path::Bindings rv; - TRACE_FUNCTION_F(path); + TRACE_FUNCTION_F(path << " offset " << start); const auto& nodes = path.nodes(); const ::HIR::Module* hmod = &hmodr; for(unsigned int i = start; i < nodes.size() - 1; i ++) { + DEBUG("m_mod_items = {" << FMT_CB(ss, for(const auto& e : hmod->m_mod_items) ss << e.first << ", ";) << "}"); auto it = hmod->m_mod_items.find(nodes[i].name()); if( it == hmod->m_mod_items.end() ) { // BZZT! @@ -735,6 +736,7 @@ namespace { } ::AST::Path::Bindings Resolve_Use_GetBinding__ext(const Span& span, const ::AST::Crate& crate, const ::AST::Path& path, const AST::ExternCrate& ec, unsigned int start) { + DEBUG("Crate " << ec.m_name); auto rv = Resolve_Use_GetBinding__ext(span, crate, path, ec.m_hir->m_root_module, start); if( start + 1 == path.nodes().size() ) { |