Change result_id to use is_valid instead of an optional. (#2449)

Incrementally shrinks size, but should also make the errors a bit clearer with better context.
This commit is contained in:
Jon Ross-Perkins
2022-12-07 16:30:23 -08:00
committed by GitHub
parent ee998c99ff
commit 34b5349df9
4 changed files with 21 additions and 8 deletions
@@ -37,8 +37,11 @@ class SemanticsParseTreeHandler {
struct TraversalStackEntry {
ParseTree::Node parse_node;
std::optional<SemanticsNodeId> result_id;
// The result_id may be invalid if there's no result.
SemanticsNodeId result_id;
};
static_assert(sizeof(TraversalStackEntry) == 8,
"Unexpected TraversalStackEntry size");
// Adds an identifier for a DeclaredName node, returning its reference.
auto AddIdentifier(ParseTree::Node decl_node) -> SemanticsIdentifierId;