summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/ast/function-dec.cc
blob: c45ca0d7dcf0ce23b471166b819cede66fba165b (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
/**
 ** \file ast/function-dec.cc
 ** \brief Implementation of ast::FunctionDec.
 */

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

namespace ast
{
  FunctionDec::FunctionDec(const Location& location,
                           misc::symbol name,
                           VarChunk* formals,
                           NameTy* result,
                           Exp* body)
    : Dec(location, name)
    , TypeConstructor()
    , formals_(formals)
    , result_(result)
    , body_(body)
  {}

  FunctionDec::~FunctionDec()
  {
    delete formals_;
    delete result_;
    delete body_;
  }

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

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