Line data Source code
1 : #ifndef CONSTRUCTOR_H
2 : #define CONSTRUCTOR_H
3 :
4 : #include "../../../../parsingAnalysis/ast/functions/parameters.h"
5 : #include "../../../symbol.h"
6 : #include "genericParameter.h"
7 : #include <memory>
8 :
9 : namespace nicole {
10 :
11 : class AST_BODY;
12 :
13 : class Constructor final : public Symbol {
14 : private:
15 : std::vector<GenericParameter> generics_;
16 : mutable Parameters params_;
17 : mutable std::shared_ptr<Type> returnType_;
18 : std::shared_ptr<AST_BODY> body_;
19 :
20 : public:
21 : explicit Constructor(const std::string &id,
22 : const std::vector<GenericParameter> &generics,
23 : const Parameters ¶ms,
24 : const std::shared_ptr<Type> &returnType,
25 : const std::shared_ptr<AST_BODY> &body) noexcept
26 0 : : Symbol{id}, generics_{generics}, params_{params},
27 0 : returnType_{returnType}, body_{body} {}
28 :
29 0 : [[nodiscard]] const std::vector<GenericParameter> &generics() const noexcept {
30 0 : return generics_;
31 0 : }
32 :
33 0 : [[nodiscard]] const Parameters ¶ms() const noexcept { return params_; }
34 :
35 0 : [[nodiscard]] const std::shared_ptr<Type> &returnType() const noexcept {
36 0 : return returnType_;
37 0 : }
38 :
39 0 : [[nodiscard]] const std::shared_ptr<AST_BODY> &body() const noexcept {
40 0 : return body_;
41 0 : }
42 :
43 0 : void setParams(const Parameters &newParams) const noexcept {
44 0 : params_ = newParams;
45 0 : }
46 :
47 : void
48 0 : setReturnType(const std::shared_ptr<Type> &newReturnType) const noexcept {
49 0 : returnType_ = newReturnType;
50 0 : }
51 : };
52 :
53 : } // namespace nicole
54 :
55 : #endif
|