summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-03-22 15:31:59 +0800
committerJohn Hodge <tpg@mutabah.net>2016-03-22 15:31:59 +0800
commitd6bd5627577df68efdb17ed908d76b8691963ac0 (patch)
tree1be0795b5bb791bdfed82e950b8d3d76f08c12cd /src
parent2db4633001c72f89de5073b26c6b8c3f1a19baa6 (diff)
downloadmrust-d6bd5627577df68efdb17ed908d76b8691963ac0.tar.gz
AST - Ignore None items when searching by name
Diffstat (limited to 'src')
-rw-r--r--src/ast/ast.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp
index 72b4455c..ea709be4 100644
--- a/src/ast/ast.cpp
+++ b/src/ast/ast.cpp
@@ -331,20 +331,20 @@ typename ::std::vector<Named<T> >::const_iterator find_named(const ::std::vector
{
return ::std::find_if(vec.begin(), vec.end(), [&name](const Named<T>& x) {
//DEBUG("find_named - x.name = " << x.name);
- return x.name == name;
+ return x.name == name && !x.data.is_None();
});
}
Module::ItemRef Module::find_item(const ::std::string& needle, bool allow_leaves, bool ignore_private_wildcard) const
{
- TRACE_FUNCTION_F("needle = " << needle);
+ TRACE_FUNCTION_F("path = " << m_my_path << ", needle = " << needle);
{
auto it = find_named(this->items(), needle);
if( it != this->items().end() ) {
TU_MATCH(::AST::Item, (it->data), (e),
(None,
- break;
+ throw ::std::runtime_error("BUG: Hit a None item");
),
(Module, return ItemRef(e); ),
(Crate, return ItemRef(e.name); ),