summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/ast/record-exp.hh
blob: f0ba79ebd547f9e8af3e22ca4895819b621002c7 (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
52
53
54
55
56
57
/**
 ** \file ast/record-exp.hh
 ** \brief Declaration of ast::RecordExp.
 */

#pragma once

#include <ast/exp.hh>
#include <ast/field-init.hh>
#include <ast/name-ty.hh>

namespace ast
{
  /// RecordExp.
  class RecordExp : public Exp
  {
  public:
    /** \name Ctor & dtor.
     ** \{ */
    /// Construct a RecordExp node.
    RecordExp(const Location& location,
              NameTy* type_name,
              fieldinits_type* fields);
    RecordExp(const RecordExp&) = delete;
    RecordExp& operator=(const RecordExp&) = delete;
    /// Destroy a RecordExp node.
    ~RecordExp() 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 identifier of the record type.
    const NameTy& type_name_get() const;
    /// Return identifier of the record type.
    NameTy& type_name_get();
    /// Return list of field initializations.
    const fieldinits_type& fields_get() const;
    /// Return list of field initializations.
    fieldinits_type& fields_get();
    /** \} */

  protected:
    /// Identifier of the record type.
    NameTy* type_name_;
    /// List of field initializations.
    fieldinits_type* fields_;
  };
} // namespace ast
#include <ast/record-exp.hxx>