diff options
author | John Hodge <tpg@mutabah.net> | 2016-09-24 18:00:38 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-09-24 18:00:38 +0800 |
commit | f84f2971e145b582425f2d74b4d99416fbe34f33 (patch) | |
tree | 6cb749de00beea75ce540eacbd94c3a2ce69c383 /src/mir/from_hir_match.cpp | |
parent | 2f6b01e92050e9b0df1eb487b4d4f1644c8626a4 (diff) | |
download | mrust-f84f2971e145b582425f2d74b4d99416fbe34f33.tar.gz |
MIR Gen Match - Fix edge case where DTN simplify didn't work
Diffstat (limited to 'src/mir/from_hir_match.cpp')
-rw-r--r-- | src/mir/from_hir_match.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mir/from_hir_match.cpp b/src/mir/from_hir_match.cpp index d9c33d5f..c7c0ad8f 100644 --- a/src/mir/from_hir_match.cpp +++ b/src/mir/from_hir_match.cpp @@ -1601,6 +1601,14 @@ void DecisionTreeNode::simplify() TU_MATCHA( (m_branches), (e), (Unset, + H::simplify_branch(m_default); + // Replace `this` with `m_default` if `m_default` is a subtree + // - Fixes the edge case for the top of the tree + if( m_default.is_Subtree() ) + { + *this = mv$(*m_default.as_Subtree()); + } + return ; ), (Bool, H::simplify_branch(e.false_branch); |