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