summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/ast/var-dec.cc
blob: 85e7eba6597b5bdca134adf1aa86754074042c6c (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/var-dec.cc
 ** \brief Implementation of ast::VarDec.
 */

#include <ast/var-dec.hh>
#include <ast/visitor.hh>

namespace ast
{

  VarDec::VarDec(const Location& location,
                 misc::symbol name,
                 NameTy* type_name,
                 Exp* init)
    : Dec(location, name)
    , Escapable()
    , type_name_(type_name)
    , init_(init)
  {}

  VarDec::~VarDec()
  {
    delete type_name_;
    delete init_;
  }

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

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