LCOV - code coverage report
Current view: top level - src/visitors/validateTree - validateEnum.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 % 2 0

            Line data    Source code
       1              : #include "../../../inc/visitors/validateTree/validateTree.h"
       2              : #include "../../../inc/parsingAnalysis/ast/enum/ast_enum.h"
       3              : #include "../../../inc/parsingAnalysis/ast/enum/ast_enumAccess.h"
       4              : #include "../../../inc/parsingAnalysis/checkPosition.h"
       5              : 
       6              : namespace nicole {
       7              : 
       8              : // statement / body / null
       9              : std::expected<bool, Error>
      10            0 : ValidateTree::visit(const AST_ENUM *node) const noexcept {
      11            0 :   if (!node) {
      12            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_ENUM");
      13            0 :   }
      14            0 :   if (CheckPosition::itsBodyAncestorHasParent(node)) {
      15            0 :     return createError(ERROR_TYPE::VALIDATE_TREE,
      16            0 :                        "a enum declaration must be outside of any scope");
      17            0 :   }
      18            0 :   return true;
      19            0 : }
      20              : 
      21              : std::expected<bool, Error>
      22            0 : ValidateTree::visit(const AST_ENUM_ACCESS *node) const noexcept {
      23            0 :   if (!node) {
      24            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_ENUM_ACCESS");
      25            0 :   }
      26            0 :   if (CheckPosition::hasEveryAncestorInOrder(
      27            0 :           node, {AST_TYPE::STATEMENT, AST_TYPE::BODY})) {
      28            0 :     return createError(ERROR_TYPE::VALIDATE_TREE, "dangling enum access");
      29            0 :   }
      30            0 :   return true;
      31            0 : }
      32              : 
      33              : }
        

Generated by: LCOV version 2.0-1