GCC Code Coverage Report


Directory: ../
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 8 / 0 / 8
Functions: 100.0% 3 / 0 / 3
Branches: 56.2% 9 / 0 / 16

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 362 Interface::Interface(std::string name, SymbolTableEntry *entry, Scope *scope, std::vector<Function *> methods,
12 std::vector<GenericType> templateTypes, ASTNode *declNode)
13
1/2
✓ Branch 8 → 9 taken 362 times.
✗ Branch 8 → 15 not taken.
1448 : 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 1876 std::string Interface::getScopeName() const {
22
5/8
✓ Branch 2 → 3 taken 1876 times.
✗ Branch 2 → 13 not taken.
✓ Branch 3 → 4 taken 938 times.
✓ Branch 3 → 5 taken 938 times.
✓ Branch 4 → 6 taken 938 times.
✗ Branch 4 → 13 not taken.
✓ Branch 5 → 6 taken 938 times.
✗ Branch 5 → 13 not taken.
1876 const std::string &appendix = isGenericSubstantiation() ? getSignature() : name;
23
1/2
✓ Branch 6 → 7 taken 1876 times.
✗ Branch 6 → 11 not taken.
3752 return INTERFACE_SCOPE_PREFIX + appendix;
24 1876 }
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 * @param name Interface name
31 * @param concreteTemplateTypes Concrete template types
32 * @return Name of the interface scope
33 */
34 364 std::string Interface::getScopeName(const std::string &name, const QualTypeList &concreteTemplateTypes) {
35
2/4
✓ Branch 2 → 3 taken 364 times.
✗ Branch 2 → 10 not taken.
✓ Branch 3 → 4 taken 364 times.
✗ Branch 3 → 8 not taken.
728 return INTERFACE_SCOPE_PREFIX + getSignature(name, concreteTemplateTypes);
36 }
37
38 } // namespace spice::compiler
39