Line data Source code
1 : #include "../../../inc/visitors/monomorphize/monomorphize.h"
2 : #include "../../../inc/parsingAnalysis/ast/vector/ast_index.h"
3 : #include "../../../inc/parsingAnalysis/ast/vector/ast_vector.h"
4 : #include <variant>
5 :
6 : namespace nicole {
7 :
8 : std::expected<std::monostate, Error>
9 0 : Monomorphize::visit(const AST_VECTOR *node) const noexcept {
10 0 : if (!node) {
11 0 : return createError(ERROR_TYPE::NULL_NODE, "invalid AST_VECTOR");
12 0 : }
13 0 : for (const auto &value : node->values()) {
14 0 : const auto result{value->accept(*this)};
15 0 : if (!result) {
16 0 : return createError(result.error());
17 0 : }
18 0 : }
19 0 : return {};
20 0 : }
21 :
22 : std::expected<std::monostate, Error>
23 0 : Monomorphize::visit(const AST_INDEX *node) const noexcept {
24 0 : if (!node) {
25 0 : return createError(ERROR_TYPE::NULL_NODE, "invalid AST_INDEX");
26 0 : }
27 0 : const auto result{node->index()->accept(*this)};
28 0 : if (!result) {
29 0 : return createError(result.error());
30 0 : }
31 0 : return {};
32 0 : }
33 :
34 : }
|