Line data Source code
1 : #ifndef AST_CONSTRUCTOR_CALL_H
2 : #define AST_CONSTRUCTOR_CALL_H
3 :
4 : #include "../../../tables/typeTable/types/type.h"
5 : #include "../ast.h"
6 : #include <string>
7 : #include <vector>
8 :
9 : namespace nicole {
10 :
11 : class AST_CONSTRUCTOR_CALL final : public AST {
12 : private:
13 : std::string id_;
14 : mutable std::vector<std::shared_ptr<Type>> replaceOfGenerics_;
15 : mutable std::vector<std::shared_ptr<AST>> parameters_;
16 :
17 : public:
18 : explicit AST_CONSTRUCTOR_CALL(
19 : const long long unsigned nodeId, const SourceLocation &srcLoc,
20 : const std::string &id,
21 : const std::vector<std::shared_ptr<Type>> &replaceOfGenerics,
22 : const std::vector<std::shared_ptr<AST>> ¶meters) noexcept
23 0 : : AST(nodeId, AST_TYPE::CONSTRUCTOR_CALL, srcLoc), id_{id},
24 0 : replaceOfGenerics_{replaceOfGenerics}, parameters_{parameters} {}
25 :
26 0 : [[nodiscard]] const std::string &id() const noexcept { return id_; }
27 :
28 : [[nodiscard]] const std::vector<std::shared_ptr<Type>> &
29 0 : replaceOfGenerics() const noexcept {
30 0 : return replaceOfGenerics_;
31 0 : }
32 :
33 : void setReplacesOfGenerics(
34 0 : const std::vector<std::shared_ptr<Type>> &replaces) const noexcept {
35 0 : replaceOfGenerics_ = replaces;
36 0 : }
37 :
38 : [[nodiscard]] const std::vector<std::shared_ptr<AST>> &
39 0 : parameters() const noexcept {
40 0 : return parameters_;
41 0 : }
42 :
43 : [[nodiscard]] std::expected<std::string, Error>
44 0 : accept(const PrintTree &visitor) const noexcept override {
45 0 : return visitor.visit(this);
46 0 : }
47 :
48 : [[nodiscard]] std::expected<bool, Error>
49 0 : accept(const ValidateTree &visitor) const noexcept override {
50 0 : return visitor.visit(this);
51 0 : }
52 :
53 : [[nodiscard]] std::expected<std::monostate, Error>
54 0 : accept(const FillSemanticInfo &visitor) const noexcept override {
55 0 : return visitor.visit(this);
56 0 : }
57 :
58 : [[nodiscard]] std::expected<std::shared_ptr<Type>, Error>
59 0 : accept(const TypeAnalysis &visitor) const noexcept override {
60 0 : return visitor.visit(this);
61 0 : }
62 :
63 : [[nodiscard]] std::expected<std::monostate, Error>
64 0 : accept(const Monomorphize &visitor) const noexcept override {
65 0 : return visitor.visit(this);
66 0 : }
67 :
68 : [[nodiscard]] std::expected<std::shared_ptr<llvm::Value>, Error>
69 0 : accept(const CodeGeneration &visitor) const noexcept override {
70 0 : return visitor.visit(this);
71 0 : }
72 : };
73 :
74 : } // namespace nicole
75 :
76 : #endif
|