summaryrefslogtreecommitdiff
path: root/src/mir/from_hir_match.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mir/from_hir_match.cpp')
-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,