Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright (c) 2021-2025 ChilliBits. All rights reserved. | ||
2 | |||
3 | #include "ErrorManager.h" | ||
4 | |||
5 | #include <ast/ASTNodes.h> | ||
6 | |||
7 | namespace spice::compiler { | ||
8 | |||
9 | 135 | void ErrorManager::addSoftError(const ASTNode *astNode, SemanticErrorType errorType, const std::string &message) { | |
10 | // Build error message | ||
11 |
1/2✓ Branch 2 → 3 taken 135 times.
✗ Branch 2 → 20 not taken.
|
135 | const SemanticError semanticError(astNode, errorType, message); |
12 | // Add to soft errors list | ||
13 |
2/4✓ Branch 6 → 7 taken 135 times.
✗ Branch 6 → 14 not taken.
✓ Branch 7 → 8 taken 135 times.
✗ Branch 7 → 12 not taken.
|
135 | addSoftError(astNode->codeLoc, semanticError.what()); |
14 | 135 | } | |
15 | |||
16 | 135 | void ErrorManager::addSoftError(const CodeLoc &codeLoc, const std::string &message) { | |
17 | // Avoid duplicate errors | ||
18 |
2/2✓ Branch 10 → 4 taken 98 times.
✓ Branch 10 → 11 taken 126 times.
|
224 | for (const auto &[errorLoc, message] : softErrors) |
19 |
3/4✓ Branch 5 → 6 taken 98 times.
✗ Branch 5 → 16 not taken.
✓ Branch 6 → 7 taken 9 times.
✓ Branch 6 → 8 taken 89 times.
|
98 | if (errorLoc == codeLoc) |
20 | 9 | return; | |
21 |
2/4✓ Branch 11 → 12 taken 126 times.
✗ Branch 11 → 19 not taken.
✓ Branch 12 → 13 taken 126 times.
✗ Branch 12 → 17 not taken.
|
126 | softErrors.emplace_back(SoftError{codeLoc, message}); |
22 | } | ||
23 | |||
24 | } // namespace spice::compiler | ||
25 |