blob: b06a9be72bd9d1a25824d216e06897ab13fbda3f (
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
58
59
60
|
/**
** \file ast/for-exp.hh
** \brief Declaration of ast::ForExp.
*/
#pragma once
#include <ast/exp.hh>
#include <ast/var-dec.hh>
namespace ast
{
/// ForExp.
class ForExp : public Exp
{
public:
/** \name Ctor & dtor.
** \{ */
/// Construct a ForExp node.
ForExp(const Location& location, VarDec* vardec, Exp* hi, Exp* body);
ForExp(const ForExp&) = delete;
ForExp& operator=(const ForExp&) = delete;
/// Destroy a ForExp node.
~ForExp() 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 implicit variable declaration.
const VarDec& vardec_get() const;
/// Return implicit variable declaration.
VarDec& vardec_get();
/// Return high bound of the loop.
const Exp& hi_get() const;
/// Return high bound of the loop.
Exp& hi_get();
/// Return instructions executed in the loop.
const Exp& body_get() const;
/// Return instructions executed in the loop.
Exp& body_get();
/** \} */
protected:
/// Implicit variable declaration.
VarDec* vardec_;
/// High bound of the loop.
Exp* hi_;
/// Instructions executed in the loop.
Exp* body_;
};
} // namespace ast
#include <ast/for-exp.hxx>
|