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

            Line data    Source code
       1              : #include "../../../inc/visitors/codeGeneration/codeGeneration.h"
       2              : #include "../../../inc/parsingAnalysis/ast/functions/ast_funcCall.h"
       3              : #include "../../../inc/parsingAnalysis/ast/functions/ast_funcDecl.h"
       4              : #include "../../../inc/parsingAnalysis/ast/functions/ast_return.h"
       5              : 
       6              : #include <cstddef>
       7              : #include <memory>
       8              : #include <variant>
       9              : 
      10              : namespace nicole {
      11              : 
      12              : std::expected<std::shared_ptr<llvm::Value>, Error>
      13            0 : CodeGeneration::visit(const AST_FUNC_CALL *node) const noexcept {
      14            0 :   if (!node) {
      15            0 :     return createError(ERROR_TYPE::NULL_NODE, "Invalid AST_FUNC_CALL");
      16            0 :   }
      17            0 :   for (const auto &chain : node->parameters()) {
      18            0 :     const auto result{chain->accept(*this)};
      19            0 :     if (!result) {
      20            0 :       return createError(result.error());
      21            0 :     }
      22            0 :   }
      23            0 :   return {};
      24            0 : }
      25              : 
      26              : std::expected<std::shared_ptr<llvm::Value>, Error>
      27            0 : CodeGeneration::visit(const AST_FUNC_DECL *node) const noexcept {
      28            0 :   if (!node) {
      29            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_FUNC_DECL");
      30            0 :   }
      31            0 :   const auto result{node->body()->accept(*this)};
      32            0 :   if (!result) {
      33            0 :     return createError(result.error());
      34            0 :   }
      35            0 :   return {};
      36            0 : }
      37              : 
      38              : std::expected<std::shared_ptr<llvm::Value>, Error>
      39            0 : CodeGeneration::visit(const AST_RETURN *node) const noexcept {
      40            0 :   if (!node) {
      41            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_RETURN");
      42            0 :   }
      43            0 :   if (!node->expression()) {
      44            0 :     return {};
      45            0 :   }
      46            0 :   const auto result{node->expression()->accept(*this)};
      47            0 :   if (!result) {
      48            0 :     return createError(result.error());
      49            0 :   }
      50            0 :   return {};
      51            0 : }
      52              : 
      53              : }
        

Generated by: LCOV version 2.0-1