LCOV - code coverage report
Current view: top level - src/parse - ASTDumper.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 7 0.0 %
Date: 2025-03-25 01:19:55 Functions: 0 4 0.0 %
Branches: 0 8 0.0 %

           Branch data     Line data    Source code
       1                 :            : #include <mutable/parse/AST.hpp>
       2                 :            : 
       3                 :            : #include <mutable/util/macro.hpp>
       4                 :            : 
       5                 :            : 
       6                 :            : namespace m {
       7                 :            : 
       8                 :            : namespace ast {
       9                 :            : 
      10                 :            : /** Dumps a textual representation of the AST to an output stream. */
      11                 :            : struct ASTDumper : ConstASTVisitor
      12                 :            : {
      13                 :            :     std::ostream &out; ///< the output stream to write to
      14                 :            :     private:
      15                 :            :     int indent_; ///< the current level of indentation
      16                 :            : 
      17                 :            :     public:
      18                 :          0 :     ASTDumper(std::ostream &out, int indent = 0) : out(out), indent_(indent) { }
      19                 :            : 
      20                 :            :     using ConstASTVisitor::operator();
      21                 :            : #define DECLARE(CLASS) void operator()(Const<CLASS>&) override;
      22                 :            :     M_AST_LIST(DECLARE)
      23                 :            : #undef DECLARE
      24                 :            : 
      25                 :            :     private:
      26                 :            :     /** Start a new line with proper indentation. */
      27                 :          0 :     std::ostream & indent() const {
      28                 :          0 :         M_insist(indent_ >= 0, "Indent must not be negative!  Missing increment or superfluous decrement?");
      29         [ #  # ]:          0 :         if (indent_)
      30   [ #  #  #  #  :          0 :             out << '\n' << std::string(2 * indent_ - 2, ' ') << "` ";
                   #  # ]
      31                 :          0 :         return out;
      32                 :          0 :     }
      33                 :            : 
      34                 :            :     private:
      35                 :            :     void print_type(const Expr &e) const;
      36                 :            : };
      37                 :            : 
      38                 :            : }
      39                 :            : 
      40                 :            : }

Generated by: LCOV version 1.16