From 6f7f5a39f7ebf8d16000ef2538178dea72161a5b Mon Sep 17 00:00:00 2001 From: John Hodge Date: Thu, 17 Nov 2016 16:08:53 +0800 Subject: Resolve - Fix scoping of `if let` bindings --- src/resolve/absolute.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/resolve/absolute.cpp b/src/resolve/absolute.cpp index 60b6c193..c78554a7 100644 --- a/src/resolve/absolute.cpp +++ b/src/resolve/absolute.cpp @@ -1612,15 +1612,16 @@ void Resolve_Absolute_ExprNode(Context& context, ::AST::ExprNode& node) void visit(AST::ExprNode_IfLet& node) override { DEBUG("ExprNode_IfLet"); node.m_value->visit( *this ); + this->context.push_block(); Resolve_Absolute_Pattern(this->context, true, node.m_pattern); assert( node.m_true ); node.m_true->visit( *this ); + this->context.pop_block(); + if(node.m_false) node.m_false->visit(*this); - - this->context.pop_block(); } void visit(AST::ExprNode_StructLiteral& node) override { DEBUG("ExprNode_StructLiteral"); -- cgit v1.2.3