diff options
author | John Hodge <tpg@mutabah.net> | 2015-03-25 11:33:14 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-03-25 11:33:14 +0800 |
commit | b698207664e45b9b0bb9944b5c97084dfc593ed6 (patch) | |
tree | 6408e43a422aafcb65bbd9ca83555e32df18c3ff /src/ast/ast.cpp | |
parent | 303d0a93372281c471e450a7c6938ab2600d5e14 (diff) | |
download | mrust-b698207664e45b9b0bb9944b5c97084dfc593ed6.tar.gz |
HACK - Handle the case of core::iter::order importing core::ord, but also defining an 'ord' function
Diffstat (limited to 'src/ast/ast.cpp')
-rw-r--r-- | src/ast/ast.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp index 5559a4d8..988762e6 100644 --- a/src/ast/ast.cpp +++ b/src/ast/ast.cpp @@ -500,9 +500,10 @@ typename ::std::vector<Item<T> >::const_iterator find_named(const ::std::vector< });
}
-Module::ItemRef Module::find_item(const ::std::string& needle, bool ignore_private_wildcard) const
+Module::ItemRef Module::find_item(const ::std::string& needle, bool allow_leaves, bool ignore_private_wildcard) const
{
TRACE_FUNCTION_F("needle = " << needle);
+
// Sub-modules
{
auto& sms = submods();
@@ -537,7 +538,10 @@ Module::ItemRef Module::find_item(const ::std::string& needle, bool ignore_priva auto& items = this->functions();
auto it = find_named(items, needle);
if( it != items.end() ) {
- return ItemRef(it->data);
+ if( allow_leaves )
+ return ItemRef(it->data);
+ else
+ DEBUG("Skipping static, leaves not allowed");
}
}
@@ -573,7 +577,11 @@ Module::ItemRef Module::find_item(const ::std::string& needle, bool ignore_priva auto& items = this->statics();
auto it = find_named(items, needle);
if( it != items.end() ) {
- return ItemRef(it->data);
+ if( allow_leaves ) {
+ return ItemRef(it->data);
+ }
+ else
+ DEBUG("Skipping static, leaves not allowed");
}
}
|