summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/ast/type-dec.hh
blob: 0e19926c986ad436d061c71733576feee176b5d2 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
 ** \file ast/type-dec.hh
 ** \brief Declaration of ast::TypeDec.
 */

#pragma once

#include <ast/dec.hh>
#include <ast/ty.hh>
#include <ast/type-constructor.hh>

namespace ast
{
  /// TypeDec.
  class TypeDec
    : public Dec
    , public TypeConstructor
  {
  public:
    /** \name Ctor & dtor.
     ** \{ */
    /// Construct a TypeDec node.
    TypeDec(const Location& location, misc::symbol name, Ty* ty);
    TypeDec(const TypeDec&) = delete;
    TypeDec& operator=(const TypeDec&) = delete;
    /// Destroy a TypeDec node.
    ~TypeDec() override;
    /** \} */

    /// \name Visitors entry point.
    /// \{ */
    /// Accept a const visitor \a v.
    void accept(ConstVisitor& v) const override;
    /// Accept a non-const visitor \a v.
    void accept(Visitor& v) override;
    /// \}

    /** \name Accessors.
     ** \{ */
    /// Return type definition.
    const Ty& ty_get() const;
    /// Return type definition.
    Ty& ty_get();
    /** \} */

  protected:
    /// Type definition.
    Ty* ty_;
  };
} // namespace ast
#include <ast/type-dec.hxx>