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