LCOV - code coverage report
Current view: top level - src/visitors/validateTree - validateUtils.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 26 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/utils/ast_import.h"
       3              : #include "../../../inc/parsingAnalysis/ast/utils/ast_print.h"
       4              : #include "../../../inc/parsingAnalysis/checkPosition.h"
       5              : 
       6              : namespace nicole {
       7              : 
       8              : // statement / body / not null
       9              : std::expected<bool, Error>
      10            0 : ValidateTree::visit(const AST_PRINT *node) const noexcept {
      11            0 :   if (!node) {
      12            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_PRINT");
      13            0 :   }
      14            0 :   if (!CheckPosition::itsBodyAncestorHasParent(node)) {
      15            0 :     return createError(ERROR_TYPE::VALIDATE_TREE,
      16            0 :                        "a print statement only can appear in a scope");
      17            0 :   }
      18            0 :   for (const auto &chain : node->values()) {
      19            0 :     const auto result{chain->accept(*this)};
      20            0 :     if (!result) {
      21            0 :       return createError(result.error());
      22            0 :     }
      23            0 :   }
      24            0 :   return true;
      25            0 : }
      26              : 
      27              : // statement / body / null
      28              : std::expected<bool, Error>
      29            0 : ValidateTree::visit(const AST_IMPORT *node) const noexcept {
      30            0 :   if (!node) {
      31            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_IMPORT");
      32            0 :   }
      33            0 :   if (CheckPosition::itsBodyAncestorHasParent(node)) {
      34            0 :     return createError(ERROR_TYPE::VALIDATE_TREE,
      35            0 :                        "a import must appear outside of any scope");
      36            0 :   }
      37            0 :   return true;
      38            0 : }
      39              : 
      40              : }
        

Generated by: LCOV version 2.0-1