summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/type/type.hxx
blob: 392c854649f45ce829f66cb16be1d94a1913a3d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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