diff options
author | John Hodge <tpg@mutabah.net> | 2016-12-10 20:17:25 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-12-10 20:17:25 +0800 |
commit | 5c7994fe17d98405a1d533b1d9ac0579767f6a90 (patch) | |
tree | f33e9432fad5df73b1a8f173f690a29ae24502d5 /src/mir/from_hir_match.cpp | |
parent | d5f638d90d7f8a65423ed6df15e4ac6cad6d9855 (diff) | |
download | mrust-5c7994fe17d98405a1d533b1d9ac0579767f6a90.tar.gz |
MIR Match Gen - Fix incorrect arms chosen
Diffstat (limited to 'src/mir/from_hir_match.cpp')
-rw-r--r-- | src/mir/from_hir_match.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mir/from_hir_match.cpp b/src/mir/from_hir_match.cpp index aea89764..c26dbc41 100644 --- a/src/mir/from_hir_match.cpp +++ b/src/mir/from_hir_match.cpp @@ -1985,11 +1985,13 @@ void MIR_LowerHIR_Match_DecisionTree( MirBuilder& builder, MirConverter& conv, : // - Build tree by running each arm's pattern across it DEBUG("- Building decision tree"); DecisionTreeNode root_node({}); + unsigned int rule_idx = 0; for( const auto& arm_rule : arm_rules ) { auto arm_idx = arm_rule.arm_idx; DEBUG("(" << arm_idx << ", " << arm_rule.pat_idx << "): " << arm_rule.m_rules); - root_node.populate_tree_from_rule( node.m_arms[arm_idx].m_code->span(), arm_idx, arm_rule.m_rules.data(), arm_rule.m_rules.size() ); + root_node.populate_tree_from_rule( node.m_arms[arm_idx].m_code->span(), rule_idx, arm_rule.m_rules.data(), arm_rule.m_rules.size() ); + rule_idx += 1; } DEBUG("root_node = " << root_node); root_node.simplify(); |