blob: 0f8a7878e50a2dbd375f4cd395fd035001290671 (
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
|
/**
** \file ast/while-exp.hh
** \brief Declaration of ast::WhileExp.
*/
#pragma once
#include <ast/exp.hh>
namespace ast
{
/// WhileExp.
class WhileExp : public Exp
{
public:
/** \name Ctor & dtor.
** \{ */
/// Construct a WhileExp node.
WhileExp(const Location& location, Exp* test, Exp* body);
WhileExp(const WhileExp&) = delete;
WhileExp& operator=(const WhileExp&) = delete;
/// Destroy a WhileExp node.
~WhileExp() 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 exit condition of the loop.
const Exp& test_get() const;
/// Return exit condition of the loop.
Exp& test_get();
/// Return instructions executed in the loop.
const Exp& body_get() const;
/// Return instructions executed in the loop.
Exp& body_get();
/** \} */
protected:
/// Exit condition of the loop.
Exp* test_;
/// Instructions executed in the loop.
Exp* body_;
};
} // namespace ast
#include <ast/while-exp.hxx>
|