summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ast/ast.cpp2
-rw-r--r--src/ast/path.cpp16
-rw-r--r--src/convert/resolve.cpp15
3 files changed, 24 insertions, 9 deletions
diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp
index 7d0637ac..5559a4d8 100644
--- a/src/ast/ast.cpp
+++ b/src/ast/ast.cpp
@@ -495,7 +495,7 @@ template<typename T>
typename ::std::vector<Item<T> >::const_iterator find_named(const ::std::vector<Item<T> >& vec, const ::std::string& name)
{
return ::std::find_if(vec.begin(), vec.end(), [&name](const Item<T>& x) {
- DEBUG("find_named - x.name = " << x.name);
+ //DEBUG("find_named - x.name = " << x.name);
return x.name == name;
});
}
diff --git a/src/ast/path.cpp b/src/ast/path.cpp
index 1e2760ef..83cc98dc 100644
--- a/src/ast/path.cpp
+++ b/src/ast/path.cpp
@@ -321,14 +321,14 @@ void Path::bind_enum_var(const Enum& ent, const ::std::string& name, const ::std
}
void Path::bind_struct(const Struct& ent, const ::std::vector<TypeRef>& args)
{
- if( args.size() > 0 )
- {
- if( args.size() != ent.params().n_params() )
- throw ParseError::Generic("Parameter count mismatch");
- // TODO: Is it the role of this section of code to ensure that the passed args are valid?
- // - Probably not, it should instead be the type checker that does it
- // - Count validation is OK here though
- }
+ //if( args.size() > 0 )
+ //{
+ // if( args.size() != ent.params().n_params() )
+ // throw ParseError::Generic("Parameter count mismatch");
+ // // TODO: Is it the role of this section of code to ensure that the passed args are valid?
+ // // - Probably not, it should instead be the type checker that does it
+ // // - Count validation is OK here though
+ //}
DEBUG("Bound to struct");
m_binding_type = STRUCT;
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;