summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-08-13 11:44:22 +0800
committerJohn Hodge <tpg@mutabah.net>2016-08-13 11:44:22 +0800
commit855be1d45a4b00092bfcd9e770b027ec03aa096c (patch)
tree5b4ca561eacc057b6d72a8451c0f2a3f77e5b1bd
parent0a55a95701042e76fa244e4954cca20fcf6654f2 (diff)
downloadmrust-855be1d45a4b00092bfcd9e770b027ec03aa096c.tar.gz
MIR Gen Match - Fiddling
-rw-r--r--src/mir/from_hir_match.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mir/from_hir_match.cpp b/src/mir/from_hir_match.cpp
index 6bb37b01..6d15ee16 100644
--- a/src/mir/from_hir_match.cpp
+++ b/src/mir/from_hir_match.cpp
@@ -422,6 +422,31 @@ struct DecisionTreeNode
{
T start;
T end;
+
+ bool operator<(const Range<T>& x) const {
+ return (end < x.start);
+ }
+ bool operator<(const T& x) const {
+ return (end < x);
+ }
+
+ bool operator>=(const Range<T>& x) const {
+ return start > x.end || ovelaps(x);
+ }
+ bool operator>=(const T& x) const {
+ return (start >= x);
+ }
+
+ bool operator>(const Range<T>& x) const {
+ return (start > x.end);
+ }
+ bool operator>(const T& x) const {
+ return (start > x);
+ }
+
+ bool overlaps(const Range<T>& x) const {
+ return (x.start <= start && start <= x.end) || (x.start <= end && end <= x.end);
+ }
};
TAGGED_UNION( Values, Unset,