summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/type/type.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'tiger-compiler/src/type/type.hxx')
-rw-r--r--tiger-compiler/src/type/type.hxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/tiger-compiler/src/type/type.hxx b/tiger-compiler/src/type/type.hxx
new file mode 100644
index 0000000..392c854
--- /dev/null
+++ b/tiger-compiler/src/type/type.hxx
@@ -0,0 +1,37 @@
+/**
+ ** \file type/type.hxx
+ ** \brief Inline methods for type::Type.
+ */
+#pragma once
+
+#include <misc/contract.hh>
+#include <type/type.hh>
+
+namespace type
+{
+ inline bool operator==(const Type& lhs, const Type& rhs)
+ {
+ // FIXME DONE: Some code was deleted here.
+ const Type* lhs_primal = &lhs.actual();
+ const Type* rhs_primal = &rhs.actual();
+
+ while (&rhs_primal->actual() != rhs_primal && rhs_primal != lhs_primal)
+ {
+ rhs_primal = &rhs_primal->actual();
+ }
+
+ while (&lhs_primal->actual() != lhs_primal && lhs_primal != rhs_primal)
+ {
+ lhs_primal = &lhs_primal->actual();
+ }
+
+ return lhs_primal == rhs_primal;
+ }
+
+ inline bool operator!=(const Type& lhs, const Type& rhs)
+ {
+ // FIXME DONE: Some code was deleted here.
+ return !(lhs == rhs);
+ }
+
+} // namespace type