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

#include <misc/symbol.hh>
#include <type/fwd.hh>
#include <type/type.hh>

namespace type
{
  /** \brief The base type for Record fields.
   **
   ** Very much like Named, but it is *not* a Type. */
  class Field
  {
  public:
    /** \name Ctor & dtor.
     ** \{ */
    /** \brief Construct a Field.
     ** \param name field's identifier.
     ** \param type field's type. */
    Field(misc::symbol name, const Type& type);
    /** \} */

    /** \name Accessors.
     ** \{ */
    /// Return the field's name.
    misc::symbol name_get() const;
    /// Return the field's type.
    const Type& type_get() const;
    /** \} */

  protected:
    /// Field's identifier.
    misc::symbol name_;

    /// Field's type.
    const Type& type_;
  };

} // namespace type

#include <type/field.hxx>