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

            Line data    Source code
       1              : #include "../../../inc/visitors/validateTree/validateTree.h"
       2              : #include "../../../inc/parsingAnalysis/ast/literals/ast_bool.h"
       3              : #include "../../../inc/parsingAnalysis/ast/literals/ast_char.h"
       4              : #include "../../../inc/parsingAnalysis/ast/literals/ast_double.h"
       5              : #include "../../../inc/parsingAnalysis/ast/literals/ast_float.h"
       6              : #include "../../../inc/parsingAnalysis/ast/literals/ast_int.h"
       7              : #include "../../../inc/parsingAnalysis/ast/literals/ast_null.h"
       8              : #include "../../../inc/parsingAnalysis/ast/literals/ast_string.h"
       9              : #include "../../../inc/parsingAnalysis/checkPosition.h"
      10              : 
      11              : namespace nicole {
      12              : 
      13              : std::expected<bool, Error>
      14            0 : ValidateTree::visit(const AST_BOOL *node) const noexcept {
      15            0 :   if (!node) {
      16            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_BOOL");
      17            0 :   }
      18            0 :   if (CheckPosition::hasEveryAncestorInOrder(
      19            0 :           node, {AST_TYPE::STATEMENT, AST_TYPE::BODY})) {
      20            0 :     return createError(ERROR_TYPE::VALIDATE_TREE, "dangling bool");
      21            0 :   }
      22            0 :   return true;
      23            0 : }
      24              : 
      25              : std::expected<bool, Error>
      26            0 : ValidateTree::visit(const AST_CHAR *node) const noexcept {
      27            0 :   if (!node) {
      28            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_CHAR");
      29            0 :   }
      30            0 :   if (CheckPosition::hasEveryAncestorInOrder(
      31            0 :           node, {AST_TYPE::STATEMENT, AST_TYPE::BODY})) {
      32            0 :     return createError(ERROR_TYPE::VALIDATE_TREE, "dangling char");
      33            0 :   }
      34            0 :   return true;
      35            0 : }
      36              : 
      37              : std::expected<bool, Error>
      38            0 : ValidateTree::visit(const AST_DOUBLE *node) const noexcept {
      39            0 :   if (!node) {
      40            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_DOUBLE");
      41            0 :   }
      42            0 :   if (CheckPosition::hasEveryAncestorInOrder(
      43            0 :           node, {AST_TYPE::STATEMENT, AST_TYPE::BODY})) {
      44            0 :     return createError(ERROR_TYPE::VALIDATE_TREE, "dangling double");
      45            0 :   }
      46            0 :   return true;
      47            0 : }
      48              : 
      49              : std::expected<bool, Error>
      50            0 : ValidateTree::visit(const AST_FLOAT *node) const noexcept {
      51            0 :   if (!node) {
      52            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_FLOAT");
      53            0 :   }
      54            0 :   if (CheckPosition::hasEveryAncestorInOrder(
      55            0 :           node, {AST_TYPE::STATEMENT, AST_TYPE::BODY})) {
      56            0 :     return createError(ERROR_TYPE::VALIDATE_TREE, "dangling float");
      57            0 :   }
      58            0 :   return true;
      59            0 : }
      60              : 
      61              : std::expected<bool, Error>
      62            0 : ValidateTree::visit(const AST_INT *node) const noexcept {
      63            0 :   if (!node) {
      64            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_INT");
      65            0 :   }
      66            0 :   if (CheckPosition::hasEveryAncestorInOrder(
      67            0 :           node, {AST_TYPE::STATEMENT, AST_TYPE::BODY})) {
      68            0 :     return createError(ERROR_TYPE::VALIDATE_TREE, "dangling int");
      69            0 :   }
      70            0 :   return true;
      71            0 : }
      72              : 
      73              : std::expected<bool, Error>
      74            0 : ValidateTree::visit(const AST_NULL *node) const noexcept {
      75            0 :   if (!node) {
      76            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_NULL");
      77            0 :   }
      78            0 :   if (CheckPosition::hasEveryAncestorInOrder(
      79            0 :           node, {AST_TYPE::STATEMENT, AST_TYPE::BODY})) {
      80            0 :     return createError(ERROR_TYPE::VALIDATE_TREE, "dangling null");
      81            0 :   }
      82            0 :   return true;
      83            0 : }
      84              : 
      85              : std::expected<bool, Error>
      86            0 : ValidateTree::visit(const AST_STRING *node) const noexcept {
      87            0 :   if (!node) {
      88            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_STRING");
      89            0 :   }
      90            0 :   if (CheckPosition::hasEveryAncestorInOrder(
      91            0 :           node, {AST_TYPE::STATEMENT, AST_TYPE::BODY})) {
      92            0 :     return createError(ERROR_TYPE::VALIDATE_TREE, "dangling string");
      93            0 :   }
      94            0 :   return true;
      95            0 : }
      96              : 
      97              : }
        

Generated by: LCOV version 2.0-1