GCC Code Coverage Report


Directory: ../
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 17 / 0 / 17
Functions: 100.0% 6 / 0 / 6
Branches: 50.0% 4 / 0 / 8

src/symboltablebuilder/ScopeHandle.cpp
Line Branch Exec Source
1 // Copyright (c) 2021-2026 ChilliBits. All rights reserved.
2
3 #include "ScopeHandle.h"
4
5 #include <CompilerPass.h>
6 #include <irgenerator/IRGenerator.h>
7 #include <symboltablebuilder/Scope.h>
8
9 namespace spice::compiler {
10
11 82627 ScopeHandle::ScopeHandle(CompilerPass *pass, Scope *childScope, const ScopeType &scopeType)
12 165254 : DeferredLogic([=] { pass->changeToParentScope(scopeType); }) {
13
1/2
✓ Branch 5 → 6 taken 82627 times.
✗ Branch 5 → 7 not taken.
82627 pass->changeToScope(childScope, scopeType);
14 82627 }
15
16 82426 ScopeHandle::ScopeHandle(CompilerPass *pass, const std::string &childScopeId, const ScopeType &scopeType)
17 82426 : ScopeHandle(pass, pass->currentScope->getChildScope(childScopeId), scopeType) {}
18
19 76885 ScopeHandle::ScopeHandle(IRGenerator *generator, Scope *childScope, const ScopeType &scopeType, const ASTNode *node)
20 76885 : DeferredLogic([=] {
21 76885 generator->changeToParentScope(scopeType);
22 76885 generator->diGenerator.popLexicalBlock();
23 76885 }) {
24
1/2
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 76885 times.
76885 assert(scopeType != ScopeType::FUNC_PROC_BODY); // Functions/procedures manage scopes manually
25
1/2
✓ Branch 7 → 8 taken 76885 times.
✗ Branch 7 → 10 not taken.
76885 generator->changeToScope(childScope, scopeType);
26
1/2
✓ Branch 8 → 9 taken 76885 times.
✗ Branch 8 → 10 not taken.
76885 generator->diGenerator.pushLexicalBlock(node);
27 76885 }
28
29 76885 ScopeHandle::ScopeHandle(IRGenerator *generator, const std::string &childScopeId, const ScopeType &scopeType, const ASTNode *node)
30 76885 : ScopeHandle(generator, generator->currentScope->getChildScope(childScopeId), scopeType, node) {}
31
32 } // namespace spice::compiler
33