summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/ast/let-exp.hh
blob: 7955eeb70b3fc3879349e3994ad4f21715235486 (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
/**
 ** \file ast/let-exp.hh
 ** \brief Declaration of ast::LetExp.
 */

#pragma once

#include <ast/chunk-list.hh>
#include <ast/exp.hh>
#include <misc/contract.hh>

namespace ast
{
  /// LetExp.
  class LetExp : public Exp
  {
  public:
    /** \name Ctor & dtor.
     ** \{ */
    /// Construct a LetExp node.
    LetExp(const Location& location, ChunkList* chunks, Exp* body);
    LetExp(const LetExp&) = delete;
    LetExp& operator=(const LetExp&) = delete;
    /// Destroy a LetExp node.
    ~LetExp() 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 list of declarations.
    const ChunkList& chunks_get() const;
    /// Return list of declarations.
    ChunkList& chunks_get();
    /// Return list of instructions.
    const Exp& body_get() const;
    /// Return list of instructions.
    Exp& body_get();
    /** \} */

  protected:
    /// List of declarations.
    ChunkList* chunks_;
    /// List of instructions.
    Exp* body_;
  };
} // namespace ast
#include <ast/let-exp.hxx>