Line data Source code
1 : #ifndef AST_PRINT_H
2 : #define AST_PRINT_H
3 :
4 : #include "../ast.h"
5 :
6 : namespace nicole {
7 :
8 : class AST_PRINT : public AST {
9 : private:
10 : std::vector<std::shared_ptr<AST>> values_;
11 :
12 : public:
13 : explicit AST_PRINT(const long long unsigned nodeId,
14 : const SourceLocation &srcLoc,
15 : const std::vector<std::shared_ptr<AST>> &values) noexcept
16 1 : : AST(nodeId, AST_TYPE::PRINT, srcLoc), values_{values} {}
17 :
18 : [[nodiscard]] const std::vector<std::shared_ptr<AST>> &
19 27 : values() const noexcept {
20 27 : return values_;
21 27 : }
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
|