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