From f057e423c91a7ab821b68e7ec04f3280c24a1ffc Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 28 Dec 2016 15:55:37 +1100 Subject: MIR Gen - Track exit states of loops --- src/mir/from_hir.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/mir/from_hir.cpp') diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp index 9f44df41..3e41feeb 100644 --- a/src/mir/from_hir.cpp +++ b/src/mir/from_hir.cpp @@ -547,14 +547,12 @@ namespace { target_block = &*it; } - // TODO: Add the current variable state (of variables above the loop scope) to the loop scope - // - Allowing the state after the loop is complete to be known. - - m_builder.terminate_scope_early( node.span(), target_block->scope ); if( node.m_continue ) { + m_builder.terminate_scope_early( node.span(), target_block->scope, /*loop_exit=*/false ); m_builder.end_block( ::MIR::Terminator::make_Goto(target_block->cur) ); } else { + m_builder.terminate_scope_early( node.span(), target_block->scope, /*loop_exit=*/true ); m_builder.end_block( ::MIR::Terminator::make_Goto(target_block->next) ); } } -- cgit v1.2.3