mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
@@ -23,8 +23,7 @@ static auto HandleParenCondition(Context& context, NodeKind start_kind,
|
||||
// For an open curly, assume the condition was completely omitted.
|
||||
// Expression parsing would treat the { as a struct, but instead assume it's
|
||||
// a code block and just emit an invalid parse.
|
||||
context.AddLeafNode(NodeKind::InvalidParse, *context.position(),
|
||||
/*has_error=*/true);
|
||||
context.AddInvalidParse(*context.position());
|
||||
} else {
|
||||
context.PushState(State::Expr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user