Line data Source code
1 : #ifndef AST_LOOP_H
2 : #define AST_LOOP_H
3 :
4 : #include "../conditionals/ast_condition.h"
5 : #include "../statements/ast_body.h"
6 : #include <memory>
7 :
8 : namespace nicole {
9 :
10 : class AST_LOOP : public AST {
11 : protected:
12 : std::shared_ptr<AST_CONDITION> condition_;
13 : std::shared_ptr<AST_BODY> body_;
14 :
15 : public:
16 : explicit AST_LOOP(const long long unsigned nodeId, const AST_TYPE type,
17 : const SourceLocation &srcLoc,
18 : const std::shared_ptr<AST_CONDITION> &condition,
19 : const std::shared_ptr<AST_BODY> &body) noexcept
20 9 : : AST(nodeId, type, srcLoc), condition_{condition}, body_{body} {}
21 :
22 : [[nodiscard]] const std::shared_ptr<AST_CONDITION> &
23 27 : condition() const noexcept {
24 27 : return condition_;
25 27 : }
26 :
27 27 : [[nodiscard]] const std::shared_ptr<AST_BODY> &body() const noexcept {
28 27 : return body_;
29 27 : }
30 : };
31 :
32 : } // namespace nicole
33 :
34 : #endif // AST_LOOP_H
|