diff options
author | John Hodge <tpg@mutabah.net> | 2015-03-24 23:24:28 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-03-24 23:24:28 +0800 |
commit | 303d0a93372281c471e450a7c6938ab2600d5e14 (patch) | |
tree | a30548757a7670554718f609ba051a4250856909 /src/convert/resolve.cpp | |
parent | 5db811ee419fd4288d043b2d4148f17424e15302 (diff) | |
download | mrust-303d0a93372281c471e450a7c6938ab2600d5e14.tar.gz |
resolve "if let", remove tiny bit of typecheck in path lookup
Diffstat (limited to 'src/convert/resolve.cpp')
-rw-r--r-- | src/convert/resolve.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/convert/resolve.cpp b/src/convert/resolve.cpp index 3a1f0fb7..be2bd1bb 100644 --- a/src/convert/resolve.cpp +++ b/src/convert/resolve.cpp @@ -128,6 +128,19 @@ public: m_res.m_module_stack.pop_back();
}
+ void visit(AST::ExprNode_IfLet& node)
+ {
+ DEBUG("ExprNode_IfLet");
+ AST::NodeVisitor::visit(node.m_value);
+
+ m_res.start_scope();
+ m_res.handle_pattern(node.m_pattern, TypeRef());
+ AST::NodeVisitor::visit(node.m_true);
+ m_res.end_scope();
+
+ AST::NodeVisitor::visit(node.m_false);
+ }
+
void visit(AST::ExprNode_Match& node)
{
DEBUG("ExprNode_Match");
@@ -351,6 +364,7 @@ void CPathResolver::handle_path(AST::Path& path, CASTIterator::PathMode mode) // - Invalid afaik, instead Trait::method() is used
}
+ // Search backwards up the stack of anon modules
if( m_module_stack.size() )
{
AST::Path local_path = m_module_path;
@@ -366,6 +380,7 @@ void CPathResolver::handle_path(AST::Path& path, CASTIterator::PathMode mode) local_path.nodes().pop_back();
}
}
+ // Search current module, if found return with no error
if( lookup_path_in_module(m_crate, *m_module, m_module_path, path) )
{
return;
|