summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-22 09:12:29 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-22 16:00:27 +0800
commit994526e384a5ee99a75aaba2b151616eac9e0b0e (patch)
tree3753d70fe71cf13a6d3bf7defd6e6aa20ed6b5fc /src
parent53ff82d45135b3a11b9ac2a7379bfd9748d19b38 (diff)
downloadmrust-994526e384a5ee99a75aaba2b151616eac9e0b0e.tar.gz
MIR Gen Match - DTN signed integr ranges
Diffstat (limited to 'src')
-rw-r--r--src/mir/from_hir_match.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mir/from_hir_match.cpp b/src/mir/from_hir_match.cpp
index 8e13d30d..75c0808e 100644
--- a/src/mir/from_hir_match.cpp
+++ b/src/mir/from_hir_match.cpp
@@ -2170,8 +2170,20 @@ void DecisionTreeNode::populate_tree_from_rule(const Span& sp, const PatternRule
ASSERT_BUG(sp, e.first.tag() == e.last.tag(), "");
TU_MATCHA( (e.first, e.last), (ve_start, ve_end),
(Int,
- //auto& be = GET_BRANCHES(m_branches, Signed);
- TODO(sp, "ValueRange patterns - Int");
+ auto& be = GET_BRANCHES(m_branches, Signed);
+ from_rule_valuerange(sp, be, ve_start, ve_end, "Signed", rule.field_path,
+ [&](auto& branch) {
+ if( rule_count > 1 )
+ {
+ assert( branch.as_Subtree() );
+ auto& subtree = *branch.as_Subtree();
+ subtree.populate_tree_from_rule(sp, first_rule+1, rule_count-1, and_then);
+ }
+ else
+ {
+ and_then(branch);
+ }
+ });
),
(Uint,
// TODO: Share code between the three numeric groups