LCOV - code coverage report
Current view: top level - src/visitors/codeGeneration - codeGenUserTypes.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 104 0
Test Date: 2025-04-18 15:53:49 Functions: 0.0 % 9 0

            Line data    Source code
       1              : #include "../../../inc/visitors/codeGeneration/codeGeneration.h"
       2              : #include "../../../inc/parsingAnalysis/ast/userTypes/ast_attrAccess.h"
       3              : #include "../../../inc/parsingAnalysis/ast/userTypes/ast_constructorCall.h"
       4              : #include "../../../inc/parsingAnalysis/ast/userTypes/ast_methodCall.h"
       5              : #include "../../../inc/parsingAnalysis/ast/userTypes/ast_struct.h"
       6              : #include "../../../inc/parsingAnalysis/ast/userTypes/ast_this.h"
       7              : #include <cstddef>
       8              : #include <memory>
       9              : #include <variant>
      10              : 
      11              : namespace nicole {
      12              : 
      13              : std::expected<std::shared_ptr<llvm::Value>, Error>
      14            0 : CodeGeneration::visit(const AST_STRUCT *node) const noexcept {
      15            0 :   if (!node) {
      16            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_STRUCT");
      17            0 :   }
      18            0 :   const auto constructor{node->constructor()->accept(*this)};
      19            0 :   if (!constructor) {
      20            0 :     return createError(constructor.error());
      21            0 :   }
      22            0 :   const auto destructor{node->destructor()->accept(*this)};
      23            0 :   if (!destructor) {
      24            0 :     return createError(destructor.error());
      25            0 :   }
      26            0 :   for (const auto &chain : node->methods()) {
      27            0 :     const auto result{chain->accept(*this)};
      28            0 :     if (!result) {
      29            0 :       return createError(result.error());
      30            0 :     }
      31            0 :   }
      32            0 :   return {};
      33            0 : }
      34              : 
      35              : std::expected<std::shared_ptr<llvm::Value>, Error>
      36            0 : CodeGeneration::visit(const AST_ATTR_ACCESS *node) const noexcept {
      37            0 :   if (!node) {
      38            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_ATTR_ACCESS");
      39            0 :   }
      40            0 :   return {};
      41            0 : }
      42              : 
      43              : std::expected<std::shared_ptr<llvm::Value>, Error>
      44            0 : CodeGeneration::visit(const AST_METHOD_CALL *node) const noexcept {
      45            0 :   if (!node) {
      46            0 :     return createError(ERROR_TYPE::NULL_NODE, "Invalid AST_METHOD_CALL");
      47            0 :   }
      48            0 :   for (const auto &chain : node->parameters()) {
      49            0 :     const auto result{chain->accept(*this)};
      50            0 :     if (!result) {
      51            0 :       return createError(result.error());
      52            0 :     }
      53            0 :   }
      54            0 :   return {};
      55            0 : }
      56              : 
      57              : std::expected<std::shared_ptr<llvm::Value>, Error>
      58            0 : CodeGeneration::visit(const AST_METHOD_DECL *node) const noexcept {
      59            0 :   if (!node) {
      60            0 :     return createError(ERROR_TYPE::NULL_NODE, "Invalid AST_METHOD_DECL");
      61            0 :   }
      62            0 :   const auto result{node->body()->accept(*this)};
      63            0 :   if (!result) {
      64            0 :     return createError(result.error());
      65            0 :   }
      66            0 :   return {};
      67            0 : }
      68              : 
      69              : std::expected<std::shared_ptr<llvm::Value>, Error>
      70            0 : CodeGeneration::visit(const AST_CONSTRUCTOR_DECL *node) const noexcept {
      71            0 :   if (!node) {
      72            0 :     return createError(ERROR_TYPE::NULL_NODE, "Invalid AST_CONSTRUCTOR_DECL");
      73            0 :   }
      74            0 :   if (node->super()) {
      75            0 :     const auto result{node->super()->accept(*this)};
      76            0 :     if (!result) {
      77            0 :       return createError(result.error());
      78            0 :     }
      79            0 :   }
      80            0 :   const auto result{node->body()->accept(*this)};
      81            0 :   if (!result) {
      82            0 :     return createError(result.error());
      83            0 :   }
      84            0 :   return {};
      85            0 : }
      86              : 
      87              : std::expected<std::shared_ptr<llvm::Value>, Error>
      88            0 : CodeGeneration::visit(const AST_SUPER *node) const noexcept {
      89            0 :   if (!node) {
      90            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_SUPER");
      91            0 :   }
      92            0 :   for (const auto &chain : node->arguments()) {
      93            0 :     const auto result{chain->accept(*this)};
      94            0 :     if (!result) {
      95            0 :       return createError(result.error());
      96            0 :     }
      97            0 :   }
      98            0 :   return {};
      99            0 : }
     100              : 
     101              : std::expected<std::shared_ptr<llvm::Value>, Error>
     102            0 : CodeGeneration::visit(const AST_DESTRUCTOR_DECL *node) const noexcept {
     103            0 :   if (!node) {
     104            0 :     return createError(ERROR_TYPE::NULL_NODE, "Invalid AST_DESTRUCTOR_DECL");
     105            0 :   }
     106            0 :   const auto result{node->body()->accept(*this)};
     107            0 :   if (!result) {
     108            0 :     return createError(result.error());
     109            0 :   }
     110            0 :   return {};
     111            0 : }
     112              : 
     113              : std::expected<std::shared_ptr<llvm::Value>, Error>
     114            0 : CodeGeneration::visit(const AST_THIS *node) const noexcept {
     115            0 :   if (!node) {
     116            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_THIS");
     117            0 :   }
     118            0 :   return {};
     119            0 : }
     120              : 
     121              : std::expected<std::shared_ptr<llvm::Value>, Error>
     122            0 : CodeGeneration::visit(const AST_CONSTRUCTOR_CALL *node) const noexcept {
     123            0 :   if (!node) {
     124            0 :     return createError(ERROR_TYPE::NULL_NODE, "Invalid AST_CONSTRUCTOR_CALL");
     125            0 :   }
     126            0 :   for (const auto &chain : node->parameters()) {
     127            0 :     const auto result{chain->accept(*this)};
     128            0 :     if (!result) {
     129            0 :       return createError(result.error());
     130            0 :     }
     131            0 :   }
     132            0 :   return {};
     133            0 : }
     134              : 
     135              : }
        

Generated by: LCOV version 2.0-1