diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-11-26 18:27:38 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-11-26 18:27:38 +0800 |
commit | e335207c353efec94963e273d2fc3294afc860e0 (patch) | |
tree | 97531147e90f38ed0a78b3a656f909784ef87e66 /src | |
parent | 22283e0bc5a3f8a2e45a70f18d7d05ba4040c78b (diff) | |
download | mrust-e335207c353efec94963e273d2fc3294afc860e0.tar.gz |
HIR From AST - Fix logic that auto-applies ! to loops
Diffstat (limited to 'src')
-rw-r--r-- | src/hir/from_ast_expr.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/hir/from_ast_expr.cpp b/src/hir/from_ast_expr.cpp index ef20f08d..6daf49c3 100644 --- a/src/hir/from_ast_expr.cpp +++ b/src/hir/from_ast_expr.cpp @@ -339,13 +339,9 @@ struct LowerHIR_ExprNode_Visitor: {} void visit(::HIR::ExprNode_Loop& node) override { - if( node.m_label != "" ) { - this->name_stack.push_back( &node.m_label ); - } + this->name_stack.push_back( &node.m_label ); ::HIR::ExprVisitorDef::visit(node); - if( node.m_label != "" ) { - this->name_stack.pop_back( ); - } + this->name_stack.pop_back( ); } void visit(::HIR::ExprNode_LoopControl& node) override { ::HIR::ExprVisitorDef::visit(node); @@ -355,10 +351,10 @@ struct LowerHIR_ExprNode_Visitor: else { for( auto it = this->name_stack.rbegin(); it != this->name_stack.rend(); ++ it ) { - if( node.m_label == **it ) + if( node.m_label == "" || node.m_label == **it ) return ; } - if( node.m_label == this->top_label ) { + if( node.m_label == "" || node.m_label == this->top_label ) { this->top_is_broken = true; } else { |