summaryrefslogtreecommitdiff
path: root/src/mir/from_hir.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-12-28 15:55:37 +1100
committerJohn Hodge <tpg@mutabah.net>2016-12-28 15:55:37 +1100
commitf057e423c91a7ab821b68e7ec04f3280c24a1ffc (patch)
tree94eb3e0a31635aae23ae13ee86b2a6204cf83ed4 /src/mir/from_hir.cpp
parent583686bd2ebef786e1396ecaff4c61a984135b74 (diff)
downloadmrust-f057e423c91a7ab821b68e7ec04f3280c24a1ffc.tar.gz
MIR Gen - Track exit states of loops
Diffstat (limited to 'src/mir/from_hir.cpp')
-rw-r--r--src/mir/from_hir.cpp6
1 files changed, 2 insertions, 4 deletions
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) );
}
}