GCC Code Coverage Report


Directory: ../
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 3 / 0 / 3
Functions: 100.0% 2 / 0 / 2
Branches: 50.0% 2 / 0 / 4

src/model/GenericType.h
Line Branch Exec Source
1 // Copyright (c) 2021-2026 ChilliBits. All rights reserved.
2
3 #pragma once
4
5 #include <string>
6 #include <unordered_map>
7 #include <utility>
8
9 #include <symboltablebuilder/QualType.h>
10 #include <symboltablebuilder/TypeChain.h>
11
12 namespace spice::compiler {
13
14 // Typedefs
15 using TypeMapping = std::unordered_map</*typeName=*/std::string, /*concreteType=*/QualType>;
16
17 class GenericType : public QualType {
18 public:
19 // Constructors
20
2/4
✓ Branch 2 → 3 taken 6678 times.
✗ Branch 2 → 11 not taken.
✓ Branch 5 → 6 taken 6678 times.
✗ Branch 5 → 8 not taken.
20034 explicit GenericType(const QualType &type) : QualType(type) {}
21 995 GenericType(const std::string &name, QualTypeList typeConditions)
22 995 : QualType(TY_GENERIC, name), typeConditions(std::move(typeConditions)) {}
23 GenericType() = default;
24
25 // Public methods
26 [[nodiscard]] bool checkConditionsOf(const QualType &requestedType, QualType &substantiation, bool ignoreArraySize = false,
27 bool ignoreQualifiers = false) const;
28
29 // Public members
30 bool used = false;
31
32 private:
33 // Members
34 QualTypeList typeConditions = {QualType(TY_DYN)};
35
36 // Private methods
37 [[nodiscard]] bool checkTypeConditionOf(const QualType &requestedType, QualType &substantiation, bool ignoreArraySize,
38 bool ignoreQualifiers) const;
39 };
40
41 } // namespace spice::compiler
42