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