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