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

            Line data    Source code
       1              : #include "../../../inc/visitors/validateTree/validateTree.h"
       2              : #include "../../../inc/parsingAnalysis/ast/assignments/ast_assignment.h"
       3              : #include "../../../inc/parsingAnalysis/checkPosition.h"
       4              : 
       5              : namespace nicole {
       6              : 
       7              : // statemetn / body / not null or for
       8              : std::expected<bool, Error>
       9            0 : ValidateTree::visit(const AST_ASSIGNMENT *node) const noexcept {
      10            0 :   if (!node) {
      11            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_ASSIGNMENT");
      12            0 :   }
      13            0 :   if (!(CheckPosition::itsBodyAncestorHasParent(node) or
      14            0 :         CheckPosition::isInsideForHeader(node))) {
      15            0 :     return createError(ERROR_TYPE::VALIDATE_TREE,
      16            0 :                        "a assignment can only exist "
      17            0 :                        "in a body or a for header init");
      18            0 :   }
      19            0 :   const auto left{node->left()->accept(*this)};
      20            0 :   if (!left) {
      21            0 :     return createError(left.error());
      22            0 :   }
      23            0 :   const auto right{node->value()->accept(*this)};
      24            0 :   if (!right) {
      25            0 :     return createError(right.error());
      26            0 :   }
      27            0 :   return true;
      28            0 : }
      29              : 
      30              : }
        

Generated by: LCOV version 2.0-1