From 855be1d45a4b00092bfcd9e770b027ec03aa096c Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 13 Aug 2016 11:44:22 +0800 Subject: MIR Gen Match - Fiddling --- src/mir/from_hir_match.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/mir/from_hir_match.cpp') 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& x) const { + return (end < x.start); + } + bool operator<(const T& x) const { + return (end < x); + } + + bool operator>=(const Range& x) const { + return start > x.end || ovelaps(x); + } + bool operator>=(const T& x) const { + return (start >= x); + } + + bool operator>(const Range& x) const { + return (start > x.end); + } + bool operator>(const T& x) const { + return (start > x); + } + + bool overlaps(const Range& x) const { + return (x.start <= start && start <= x.end) || (x.start <= end && end <= x.end); + } }; TAGGED_UNION( Values, Unset, -- cgit v1.2.3