summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/type/attribute.hh
blob: d252da4e22a51997e3ff747a5c44508fb6109214 (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
/**
 ** \file type/attribute.hh
 ** \brief The class Attribute (of a class type).
 */
#pragma once

#include <ast/var-dec.hh>

namespace type
{

  /** \brief The base object for Class attributes.
   **
   ** Very much like Named, but it is *not* a Type. */
  class Attribute
  {
    /** \name Constructor.
     ** \{ */
  public:
    /** \brief Construct a Attribute.
     ** \param def attribute's definition site.*/
    explicit Attribute(const ast::VarDec* def);
    /** \} */

    /** \name Accessors.
     ** \{ */
  public:
    /// Return the attribute's name.
    misc::symbol name_get() const;
    /// Return the attribute's type.
    const Type& type_get() const;
    /// Return attribute's definition site.
    const ast::VarDec* def_get() const;
    /// Set the attribute's definition site.
    void def_set(const ast::VarDec* def);
    /** \} */

  private:
    const ast::VarDec* def_;
  };

} // namespace type

#include <type/attribute.hxx>