summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/overload/liboverload.cc
blob: 766230025acb0579066d8ab95de6525a031d4ec9 (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
/**
 ** \file overload/liboverload.cc
 ** \brief Define exported type functions.
 */

#include <overload/binder.hh>
#include <overload/liboverload.hh>
#include <overload/type-checker.hh>

namespace overload
{
  std::pair<overfun_bindings_type, misc::error> bind(ast::Ast& tree)
  {
    Binder bind;
    bind(tree);
    return std::pair(std::move(bind.overfun_bindings_get()),
                     std::move(bind.error_get()));
  }

  misc::error types_check(ast::Ast& tree,
                          const overfun_bindings_type& overfun_bindings)
  {
    TypeChecker type{overfun_bindings};
    type(tree);
    return type.error_get();
  }

} // namespace overload