From 967be9e750221ab2ab783f95df79bb26d290a45e Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:07:58 +0200 Subject: add: added projects --- tiger-compiler/src/type/type.hxx | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tiger-compiler/src/type/type.hxx (limited to 'tiger-compiler/src/type/type.hxx') 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 +#include + +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 -- cgit v1.2.3