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 20091 times.
✗ Branch 2 → 11 not taken.
✓ Branch 5 → 6 taken 20091 times.
✗ Branch 5 → 8 not taken.
60273 explicit GenericType(const QualType &type) : QualType(type) {}
21 1941 GenericType(const std::string &name, QualTypeList typeConditions)
22 3882 : QualType(TY_GENERIC, name), typeConditions(std::move(typeConditions)) {}
23
24 // Public methods
25 [[nodiscard]] bool checkConditionsOf(const QualType &requestedType, QualType &substantiation, bool ignoreArraySize = false,
26 bool ignoreQualifiers = false) const;
27
28 // Public members
29 bool used = false;
30
31 private:
32 // Members
33 QualTypeList typeConditions = {QualType(TY_DYN)};
34
35 // Private methods
36 [[nodiscard]] bool checkTypeConditionOf(const QualType &requestedType, QualType &substantiation, bool ignoreArraySize,
37 bool ignoreQualifiers) const;
38 };
39
40 } // namespace spice::compiler
41