summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/ast/dec.hh
blob: f61489eb6558b16709a465a47dddf1077fc0477f (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
/**
 ** \file ast/dec.hh
 ** \brief Declaration of ast::Dec.
 */

#pragma once

#include <ast/ast.hh>
#include <ast/typable.hh>
#include <misc/symbol.hh>

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

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

    /** \name Accessors.
     ** \{ */
    /// Return name of the defined entity.
    misc::symbol name_get() const;
    /// Set name of the defined entity.
    void name_set(misc::symbol);
    /** \} */

  protected:
    /// Name of the defined entity.
    misc::symbol name_;
  };
} // namespace ast
#include <ast/dec.hxx>