Don't create two parse nodes for each => token. (#7894)

Instead of producing two parse nodes in a row for each `=>` token,
produce just one.

Assisted-by: Gemini via Antigravity
This commit is contained in:
Richard Smith authored and GitHub committed 2026-10-06 21:43:36 +00:00
1 parent a5912b8b82
commit f83518bfd7
12 files changed
+12 -28

No files matched your search

+1 -3
View File
@@ -45,11 +45,9 @@ static auto ParseLambdaBody(Context& context, Context::State state,
bool has_return_type) -> void {
if (context.PositionIs(Lex::TokenKind::EqualGreater)) {
// Terse body `=> expr`
auto arrow_token = context.Consume();
context.AddNode(NodeKind::LambdaDefinitionStart, arrow_token,
context.AddNode(NodeKind::LambdaDefinitionStart, context.Consume(),
state.has_error);
state.has_error = false;
context.AddLeafNode(NodeKind::TerseBodyArrow, arrow_token);
context.PushState(state, StateKind::LambdaBodyFinish);
context.PushStateForExpr(PrecedenceGroup::ForTopLevelExpr());
} else if (context.PositionIs(Lex::TokenKind::OpenCurlyBrace)) {