Line data Source code
1 : #include "../../../inc/visitors/codeGeneration/codeGeneration.h"
2 : #include "../../../inc/parsingAnalysis/ast/utils/ast_import.h"
3 : #include "../../../inc/parsingAnalysis/ast/utils/ast_print.h"
4 : #include <cstddef>
5 : #include <memory>
6 : #include <variant>
7 :
8 : namespace nicole {
9 :
10 : std::expected<std::shared_ptr<llvm::Value>, Error>
11 0 : CodeGeneration::visit(const AST_PRINT *node) const noexcept {
12 0 : if (!node) {
13 0 : return createError(ERROR_TYPE::NULL_NODE, "invalid AST_PRINT");
14 0 : }
15 0 : for (const auto &chain : node->values()) {
16 0 : const auto result{chain->accept(*this)};
17 0 : if (!result) {
18 0 : return createError(result.error());
19 0 : }
20 0 : }
21 0 : return {};
22 0 : }
23 :
24 : std::expected<std::shared_ptr<llvm::Value>, Error>
25 0 : CodeGeneration::visit(const AST_IMPORT *node) const noexcept {
26 0 : if (!node) {
27 0 : return createError(ERROR_TYPE::NULL_NODE, "invalid AST_IMPORT");
28 0 : }
29 0 : return {};
30 0 : }
31 :
32 : }
|