summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/ast/if-exp.cc
blob: ae1911f7095a7ed5609b8bc901b32660a8f8a69c (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
/**
 ** \file ast/if-exp.cc
 ** \brief Implementation of ast::IfExp.
 */

#include <ast/if-exp.hh>
#include <ast/visitor.hh>

namespace ast
{
  IfExp::IfExp(const Location& location,
               Exp* test,
               Exp* thenclause,
               Exp* elseclause)
    : Exp(location)
    , test_(test)
    , thenclause_(thenclause)
    , elseclause_(elseclause)
  {}

  IfExp::~IfExp()
  {
    delete test_;
    delete thenclause_;
    delete elseclause_;
  }

  void IfExp::accept(ConstVisitor& v) const { v(*this); }

  void IfExp::accept(Visitor& v) { v(*this); }
} // namespace ast