Line data Source code
1 : #include "../../../inc/visitors/codeGeneration/codeGeneration.h"
2 :
3 : #include "../../../inc/parsingAnalysis/ast/assignments/ast_assignment.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_ASSIGNMENT *node) const noexcept {
11 0 : if (!node) {
12 0 : return createError(ERROR_TYPE::NULL_NODE, "invalid AST_ASSIGNMENT");
13 0 : }
14 0 : const auto left{node->left()->accept(*this)};
15 0 : if (!left) {
16 0 : return createError(left.error());
17 0 : }
18 0 : const auto right{node->value()->accept(*this)};
19 0 : if (!right) {
20 0 : return createError(right.error());
21 0 : }
22 0 : return {};
23 0 : }
24 :
25 : }
|