Line data Source code
1 : #include "../../../inc/visitors/monomorphize/monomorphize.h"
2 : #include "../../../inc/parsingAnalysis/ast/pointer/ast_delete.h"
3 : #include "../../../inc/parsingAnalysis/ast/pointer/ast_deref.h"
4 : #include "../../../inc/parsingAnalysis/ast/pointer/ast_new.h"
5 : #include <variant>
6 :
7 : namespace nicole {
8 :
9 : std::expected<std::monostate, Error>
10 0 : Monomorphize::visit(const AST_DELETE *node) const noexcept {
11 0 : if (!node) {
12 0 : return createError(ERROR_TYPE::NULL_NODE, "invalid AST_DELETE");
13 0 : }
14 0 : const auto result{node->value()->accept(*this)};
15 0 : if (!result) {
16 0 : return createError(result.error());
17 0 : }
18 0 : return {};
19 0 : }
20 :
21 : std::expected<std::monostate, Error>
22 0 : Monomorphize::visit(const AST_NEW *node) const noexcept {
23 0 : if (!node) {
24 0 : return createError(ERROR_TYPE::NULL_NODE, "invalid AST_NEW");
25 0 : }
26 0 : const auto result{node->value()->accept(*this)};
27 0 : if (!result) {
28 0 : return createError(result.error());
29 0 : }
30 0 : return {};
31 0 : }
32 :
33 : std::expected<std::monostate, Error>
34 0 : Monomorphize::visit(const AST_DEREF *node) const noexcept {
35 0 : if (!node) {
36 0 : return createError(ERROR_TYPE::NULL_NODE, "invalid AST_DEREF");
37 0 : }
38 0 : const auto result{node->value()->accept(*this)};
39 0 : if (!result) {
40 0 : return createError(result.error());
41 0 : }
42 0 : return {};
43 0 : }
44 :
45 : }
|