summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/ast/visitor.hxx
blob: 2765f80019fc3038d92f485fd2e72355cdbffcf0 (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
/**
 ** \file ast/visitor.hxx
 ** \brief Definition of ast::Visitor.
 */

#pragma once

#include <ast/ast.hh>
#include <ast/visitor.hh>

namespace ast
{
  template <template <typename> class Const> GenVisitor<Const>::~GenVisitor() {}

  template <template <typename> class Const>
  void GenVisitor<Const>::operator()(const_t<ast::Ast>& e)
  {
    e.accept(*this);
  }

  template <template <typename> class Const>
  template <class E>
  void GenVisitor<Const>::operator()(E* e)
  {
    e->accept(*this);
  }

  template <template <typename> class Const>
  template <typename E>
  void GenVisitor<Const>::accept(E* e)
  {
    if (e)
      e->accept(*this);
  }

} // namespace ast