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