Line data Source code
1 : #ifndef AST_DO_WHILE_H
2 : #define AST_DO_WHILE_H
3 :
4 : #include "../conditionals/ast_condition.h"
5 : #include "ast_loop.h"
6 : #include <memory>
7 :
8 : namespace nicole {
9 :
10 : class AST_DO_WHILE : public AST_LOOP {
11 : private:
12 : std::shared_ptr<AST_CONDITION> condition_;
13 :
14 : public:
15 : explicit AST_DO_WHILE(
16 : const long long unsigned nodeId, const SourceLocation &srcLoc,
17 : const std::shared_ptr<AST_BODY> &body,
18 : const std::shared_ptr<AST_CONDITION> &condition) noexcept
19 3 : : AST_LOOP{nodeId, AST_TYPE::DO_WHILE, srcLoc, condition, body} {}
20 :
21 : [[nodiscard]] std::expected<std::string, Error>
22 0 : accept(const PrintTree &visitor) const noexcept override {
23 0 : return visitor.visit(this);
24 0 : }
25 :
26 : [[nodiscard]] std::expected<bool, Error>
27 0 : accept(const ValidateTree &visitor) const noexcept override {
28 0 : return visitor.visit(this);
29 0 : }
30 :
31 : [[nodiscard]] std::expected<std::monostate, Error>
32 0 : accept(const FillSemanticInfo &visitor) const noexcept override {
33 0 : return visitor.visit(this);
34 0 : }
35 :
36 : [[nodiscard]] std::expected<std::shared_ptr<Type>, Error>
37 0 : accept(const TypeAnalysis &visitor) const noexcept override {
38 0 : return visitor.visit(this);
39 0 : }
40 :
41 : [[nodiscard]] std::expected<std::monostate, Error>
42 0 : accept(const Monomorphize &visitor) const noexcept override {
43 0 : return visitor.visit(this);
44 0 : }
45 :
46 : [[nodiscard]] std::expected<std::shared_ptr<llvm::Value>, Error>
47 0 : accept(const CodeGeneration &visitor) const noexcept override {
48 0 : return visitor.visit(this);
49 0 : }
50 : };
51 :
52 : } // namespace nicole
53 :
54 : #endif
|