Require that InvalidParse nodes must have an error (#4482)

Unifies some boilerplate AddLeafNode calls for InvalidParse, and checks
has_error in AddNode.
This commit is contained in:
Jon Ross-Perkins
2024-11-05 00:40:08 +00:00
committed by GitHub
parent 26e58b4587
commit 2841e9a67e
10 changed files with 31 additions and 34 deletions
+1 -2
View File
@@ -176,8 +176,7 @@ auto HandleMatchCaseAfterPattern(Context& context) -> void {
context.AddLeafNode(NodeKind::MatchCaseGuardStart, *context.position(),
true);
context.AddLeafNode(NodeKind::InvalidParse, *context.position(),
/*has_error=*/true);
context.AddInvalidParse(*context.position());
state = context.PopState();
context.AddNode(NodeKind::MatchCaseGuard, *context.position(),
/*has_error=*/true);