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