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

            Line data    Source code
       1              : #include "../../../inc/visitors/printTree/printTree.h"
       2              : #include "../../../inc/parsingAnalysis/ast/utils/ast_import.h"
       3              : #include "../../../inc/parsingAnalysis/ast/utils/ast_print.h"
       4              : #include <ostream>
       5              : 
       6              : namespace nicole {
       7              : 
       8              : std::expected<std::string, Error>
       9            0 : PrintTree::visit(const AST_PRINT *node) const noexcept {
      10            0 :   if (!node) {
      11            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_PRINT");
      12            0 :   }
      13            0 :   std::ostringstream result;
      14            0 :   result << indent_ << "Print Statement:\n";
      15            0 :   increaseIndent();
      16            0 :   increaseIndent();
      17            0 :   for (const auto &expr : node->values()) {
      18            0 :     const auto toStr{expr->accept(*this)};
      19            0 :     if (!toStr) {
      20            0 :       return createError(toStr.error());
      21            0 :     }
      22            0 :     result << indent_ << "Expression:\n" << *toStr;
      23            0 :   }
      24            0 :   decreaseIndent();
      25            0 :   decreaseIndent();
      26            0 :   return result.str();
      27            0 : }
      28              : 
      29              : std::expected<std::string, Error>
      30            0 : PrintTree::visit(const AST_IMPORT *node) const noexcept {
      31            0 :   if (!node) {
      32            0 :     return createError(ERROR_TYPE::NULL_NODE, "invalid AST_IMPORT");
      33            0 :   }
      34            0 :   std::ostringstream result;
      35            0 :   result << indent_ << "Import:\n";
      36            0 :   increaseIndent();
      37            0 :   result << indent_ << "File: " << node->path().string() << "\n";
      38            0 :   decreaseIndent();
      39            0 :   return result.str();
      40            0 : }
      41              : 
      42              : }
        

Generated by: LCOV version 2.0-1