Line data Source code
1 : #include "../../../inc/visitors/fillSemanticInfo/fillSemanticInfo.h"
2 : #include "../../../inc/parsingAnalysis/ast/operators/ast_binary.h"
3 : #include "../../../inc/parsingAnalysis/ast/operators/ast_unary.h"
4 : #include <variant>
5 :
6 : namespace nicole {
7 :
8 : std::expected<std::monostate, Error>
9 0 : FillSemanticInfo::visit(const AST_BINARY *node) const noexcept {
10 0 : if (!node) {
11 0 : return createError(ERROR_TYPE::NULL_NODE, "invalid AST_BINARY");
12 0 : }
13 0 : const auto left{node->left()->accept(*this)};
14 0 : if (!left) {
15 0 : return createError(left.error());
16 0 : }
17 0 : const auto right{node->right()->accept(*this)};
18 0 : if (!right) {
19 0 : return createError(right.error());
20 0 : }
21 0 : return {};
22 0 : }
23 :
24 : std::expected<std::monostate, Error>
25 0 : FillSemanticInfo::visit(const AST_UNARY *node) const noexcept {
26 0 : if (!node) {
27 0 : return createError(ERROR_TYPE::NULL_NODE, "invalid AST_UNARY");
28 0 : }
29 0 : return node->value()->accept(*this);
30 0 : }
31 :
32 : }
|