LCOV - code coverage report
Current view: top level - inc/parsingAnalysis/ast/conditionals - ast_switch.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 37.9 % 29 11
Test Date: 2025-04-18 15:53:49 Functions: 40.0 % 10 4

            Line data    Source code
       1              : #ifndef AST_SWITCH_H
       2              : #define AST_SWITCH_H
       3              : 
       4              : #include "ast_case.h"
       5              : #include "ast_condition.h"
       6              : #include "ast_default.h"
       7              : #include <memory>
       8              : 
       9              : namespace nicole {
      10              : 
      11              : class AST_SWITCH : public AST {
      12              : private:
      13              :   std::shared_ptr<AST_CONDITION> condition_;
      14              :   std::vector<std::shared_ptr<AST_CASE>> cases_;
      15              :   std::shared_ptr<AST_DEFAULT> default_;
      16              : 
      17              : public:
      18              :   explicit AST_SWITCH(const long long unsigned nodeId,
      19              :                       const SourceLocation &srcLoc,
      20              :                       const std::shared_ptr<AST_CONDITION> &condition,
      21              :                       const std::vector<std::shared_ptr<AST_CASE>> &cases,
      22              :                       const std::shared_ptr<AST_DEFAULT> &default__) noexcept
      23            1 :       : AST(nodeId, AST_TYPE::SWITCH, srcLoc), condition_{condition},
      24            1 :         cases_{cases}, default_{default__} {}
      25              : 
      26              :   [[nodiscard]] const std::shared_ptr<AST_CONDITION> &
      27            9 :   condition() const noexcept {
      28            9 :     return condition_;
      29            9 :   }
      30              : 
      31              :   [[nodiscard]] const std::vector<std::shared_ptr<AST_CASE>> &
      32           18 :   cases() const noexcept {
      33           18 :     return cases_;
      34           18 :   }
      35              : 
      36              :   [[nodiscard]] const std::shared_ptr<AST_DEFAULT> &
      37            9 :   defaultCase() const noexcept {
      38            9 :     return default_;
      39            9 :   }
      40              : 
      41              :   [[nodiscard]] std::expected<std::string, Error>
      42            0 :   accept(const PrintTree &visitor) const noexcept override {
      43            0 :     return visitor.visit(this);
      44            0 :   }
      45              : 
      46              :   [[nodiscard]] std::expected<bool, Error>
      47            0 :   accept(const ValidateTree &visitor) const noexcept override {
      48            0 :     return visitor.visit(this);
      49            0 :   }
      50              : 
      51              :   [[nodiscard]] std::expected<std::monostate, Error>
      52            0 :   accept(const FillSemanticInfo &visitor) const noexcept override {
      53            0 :     return visitor.visit(this);
      54            0 :   }
      55              : 
      56              :   [[nodiscard]] std::expected<std::shared_ptr<Type>, Error>
      57            0 :   accept(const TypeAnalysis &visitor) const noexcept override {
      58            0 :     return visitor.visit(this);
      59            0 :   }
      60              : 
      61              :   [[nodiscard]] std::expected<std::monostate, Error>
      62            0 :   accept(const Monomorphize &visitor) const noexcept override {
      63            0 :     return visitor.visit(this);
      64            0 :   }
      65              : 
      66              :   [[nodiscard]] std::expected<std::shared_ptr<llvm::Value>, Error>
      67            0 :   accept(const CodeGeneration &visitor) const noexcept override {
      68            0 :     return visitor.visit(this);
      69            0 :   }
      70              : };
      71              : 
      72              : } // namespace nicole
      73              : 
      74              : #endif
        

Generated by: LCOV version 2.0-1