src/model/Interface.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright (c) 2021-2026 ChilliBits. All rights reserved. | ||
| 2 | |||
| 3 | #include "Interface.h" | ||
| 4 | |||
| 5 | #include <model/GenericType.h> | ||
| 6 | |||
| 7 | namespace spice::compiler { | ||
| 8 | |||
| 9 | static constexpr auto INTERFACE_SCOPE_PREFIX = "interface:"; | ||
| 10 | |||
| 11 | 105 | Interface::Interface(std::string name, SymbolTableEntry *entry, Scope *scope, std::vector<Function *> methods, | |
| 12 | 105 | std::vector<GenericType> templateTypes, ASTNode *declNode) | |
| 13 |
1/2✓ Branch 6 → 7 taken 105 times.
✗ Branch 6 → 12 not taken.
|
105 | : StructBase(std::move(name), entry, scope, std::move(templateTypes), declNode), methods(std::move(methods)) {} |
| 14 | |||
| 15 | /** | ||
| 16 | * Retrieve the name of the scope, where signatures are placed. This is used to navigate to the scope of the interface | ||
| 17 | * from the parent scope. | ||
| 18 | * | ||
| 19 | * @return Name of the interface scope | ||
| 20 | */ | ||
| 21 | 334 | std::string Interface::getScopeName() const { | |
| 22 |
5/8✓ Branch 2 → 3 taken 334 times.
✗ Branch 2 → 13 not taken.
✓ Branch 3 → 4 taken 167 times.
✓ Branch 3 → 5 taken 167 times.
✓ Branch 4 → 6 taken 167 times.
✗ Branch 4 → 13 not taken.
✓ Branch 5 → 6 taken 167 times.
✗ Branch 5 → 13 not taken.
|
334 | const std::string &appendix = isGenericSubstantiation() ? getSignature() : name; |
| 23 |
1/2✓ Branch 6 → 7 taken 334 times.
✗ Branch 6 → 11 not taken.
|
668 | return INTERFACE_SCOPE_PREFIX + appendix; |
| 24 | 334 | } | |
| 25 | |||
| 26 | /** | ||
| 27 | * Retrieve the name of the scope, where signatures are placed. This is used to navigate to the scope of the interface | ||
| 28 | * from the parent scope. | ||
| 29 | * | ||
| 30 | * @return Name of the interface scope | ||
| 31 | */ | ||
| 32 | 107 | std::string Interface::getScopeName(const std::string &name, const QualTypeList &concreteTemplateTypes) { | |
| 33 |
2/4✓ Branch 2 → 3 taken 107 times.
✗ Branch 2 → 10 not taken.
✓ Branch 3 → 4 taken 107 times.
✗ Branch 3 → 8 not taken.
|
107 | return INTERFACE_SCOPE_PREFIX + getSignature(name, concreteTemplateTypes); |
| 34 | } | ||
| 35 | |||
| 36 | } // namespace spice::compiler | ||
| 37 |