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% 1 / 0 / 1
Branches: -% 0 / 0 / 0

src/model/Struct.h
Line Branch Exec Source
1 // Copyright (c) 2021-2026 ChilliBits. All rights reserved.
2
3 #pragma once
4
5 #include <string>
6 #include <utility>
7 #include <vector>
8
9 #include <model/GenericType.h>
10 #include <model/StructBase.h>
11
12 namespace spice::compiler {
13
14 // Forward declarations
15 enum LifecycleState : uint8_t;
16
17 class Struct : public StructBase {
18 public:
19 // Constructors
20 729 Struct(std::string name, SymbolTableEntry *entry, Scope *scope, QualTypeList fieldTypes, std::vector<GenericType> templateTypes,
21 QualTypeList interfaceTypes, ASTNode *declNode)
22 1458 : StructBase(std::move(name), entry, scope, std::move(templateTypes), declNode), fieldTypes(std::move(fieldTypes)),
23 2187 interfaceTypes(std::move(interfaceTypes)) {}
24
25 // Public methods
26 [[nodiscard]] std::string getScopeName() const;
27 static std::string getScopeName(const std::string &name, const QualTypeList &concreteTemplateTypes = {});
28 [[nodiscard]] bool hasReferenceFields() const;
29 const SymbolTableEntry *areAllFieldsInState(LifecycleState state) const;
30 const SymbolTableEntry *areAllFieldsInitialized() const;
31 void resetFieldSymbolsToDeclared(const ASTNode *node) const;
32
33 // Public members
34 QualTypeList fieldTypes;
35 QualTypeList interfaceTypes;
36 };
37
38 } // namespace spice::compiler
39