summaryrefslogtreecommitdiff
path: root/src/resolve/use.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-04-02 12:06:07 +0800
committerJohn Hodge <tpg@mutabah.net>2016-04-02 12:06:07 +0800
commitc47ac13386ac5a597ec822ea6d73bf62ca009954 (patch)
tree7fe7dd24850cabf5fafb0a79b1b2531104d35345 /src/resolve/use.cpp
parentd5b39c4fcf80a1e84aee6080351dc990c0aa8963 (diff)
downloadmrust-c47ac13386ac5a597ec822ea6d73bf62ca009954.tar.gz
Resolve - Start building an index of names avaliable in each module
Diffstat (limited to 'src/resolve/use.cpp')
-rw-r--r--src/resolve/use.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/resolve/use.cpp b/src/resolve/use.cpp
index 43bd074f..6eb837e6 100644
--- a/src/resolve/use.cpp
+++ b/src/resolve/use.cpp
@@ -96,6 +96,22 @@ void Resolve_Use_Mod(const ::AST::Crate& crate, ::AST::Module& mod, ::AST::Path
::AST::PathBinding Resolve_Use_GetBinding_Mod(const Span& span, const ::AST::Crate& crate, const ::AST::Module& mod, const ::std::string& des_item_name)
{
+ // HACK - Catch the possibiliy of a name clash (not sure if this is really an erro)
+ {
+ bool found = false;
+ for( const auto& item : mod.items() )
+ {
+ if( item.data.is_None() )
+ continue ;
+ if( item.name == des_item_name ) {
+ if( found ) {
+ TODO(span, "Duplicate name found resolving use statement searching in module " << mod.path());
+ }
+ found = true;
+ }
+ }
+ }
+
for( const auto& item : mod.items() )
{
if( item.data.is_None() )