Line data Source code
1 : #ifndef AST_VAR_DECL_H
2 : #define AST_VAR_DECL_H
3 :
4 : #include "../../../tables/scope/scope.h"
5 : #include "../ast.h"
6 : #include <memory>
7 : #include <variant>
8 :
9 : namespace nicole {
10 :
11 : class AST_VAR_DECL : public AST {
12 : private:
13 : std::string id_;
14 : std::shared_ptr<AST> value_;
15 :
16 : public:
17 : explicit AST_VAR_DECL(const long long unsigned nodeId, const AST_TYPE astType,
18 : const SourceLocation &srcLoc, const std::string &id,
19 : const std::shared_ptr<AST> &value) noexcept
20 0 : : AST(nodeId, astType, srcLoc), id_{id}, value_{value} {}
21 :
22 0 : [[nodiscard]] const std::string &id() const noexcept { return id_; }
23 :
24 0 : [[nodiscard]] const std::shared_ptr<AST> &value() const noexcept {
25 0 : return value_;
26 0 : }
27 : };
28 :
29 : } // namespace nicole
30 :
31 : #endif
|