summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/expand/mod.cpp3
-rw-r--r--src/resolve/index.cpp2
-rw-r--r--src/resolve/use.cpp16
3 files changed, 11 insertions, 10 deletions
diff --git a/src/expand/mod.cpp b/src/expand/mod.cpp
index 485c0032..fff44df3 100644
--- a/src/expand/mod.cpp
+++ b/src/expand/mod.cpp
@@ -916,6 +916,9 @@ void Expand_Mod_IndexAnon(::AST::Crate& crate, ::AST::Module& mod)
DEBUG("- " << mp->path() << " dropped due to node destruction");
mp.reset();
}
+ else {
+ Expand_Mod_IndexAnon(crate, *mp);
+ }
}
}
void Expand(::AST::Crate& crate)
diff --git a/src/resolve/index.cpp b/src/resolve/index.cpp
index 089edd66..3a309305 100644
--- a/src/resolve/index.cpp
+++ b/src/resolve/index.cpp
@@ -218,7 +218,7 @@ void Resolve_Index_Module_Base(const AST::Crate& crate, AST::Module& mod)
}
};
if( i_data.path.binding().is_Unbound() ) {
- BUG(sp, "Import left unbound ("<<i_data.path<<")");
+ BUG(sp, "`use " << i_data.path << "` left unbound in module " << mod.path());
}
else {
H::handle_pb(sp, mod, i, i_data.path.binding(), false);
diff --git a/src/resolve/use.cpp b/src/resolve/use.cpp
index 31fd0734..e717f617 100644
--- a/src/resolve/use.cpp
+++ b/src/resolve/use.cpp
@@ -141,15 +141,6 @@ void Resolve_Use_Mod(const ::AST::Crate& crate, ::AST::Module& mod, ::AST::Path
use_stmt_data.alt_binding = Resolve_Use_GetBinding(span, crate, use_stmt_data.path, parent_modules, allow);
}
}
-
- for(auto& i : mod.items())
- {
- if( i.data.is_Module() )
- {
- Resolve_Use_Mod(crate, i.data.as_Module(), path + i.name);
- }
- }
- // - NOTE: Handle anon modules by iterating code (allowing correct item mappings)
struct NV:
public AST::NodeVisitorDef
@@ -178,11 +169,18 @@ void Resolve_Use_Mod(const ::AST::Crate& crate, ::AST::Module& mod, ::AST::Path
} expr_iter(crate, mod);
// TODO: Check that all code blocks are covered by these
+ // - NOTE: Handle anon modules by iterating code (allowing correct item mappings)
for(auto& i : mod.items())
{
TU_MATCH_DEF( AST::Item, (i.data), (e),
(
),
+ (Module,
+ Resolve_Use_Mod(crate, i.data.as_Module(), path + i.name);
+ ),
+ (Impl,
+ TODO(Span(), "Recurse into Impl");
+ ),
(Trait,
for(auto& ti : e.items())
{