Use FileStackNode constructor to avoid std::monostate possibility

This commit is contained in:
Rangi42
2024-03-05 14:19:23 -05:00
parent 74539f08ba
commit bd88787cb3
4 changed files with 42 additions and 68 deletions

View File

@@ -38,10 +38,6 @@ extern bool disablePadding;
} while (0)
struct FileStackNode {
FileStackNode *parent;
// Line at which the parent context was exited; meaningless for the root level
uint32_t lineNo;
enum FileStackNodeType type;
std::variant<
std::monostate, // Default constructed; `.type` and `.data` must be set manually
@@ -50,6 +46,10 @@ struct FileStackNode {
>
data;
FileStackNode *parent;
// Line at which the parent context was exited; meaningless for the root level
uint32_t lineNo;
// REPT iteration counts since last named node, in reverse depth order
std::vector<uint32_t> &iters();
std::vector<uint32_t> const &iters() const;