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