mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-15 10:58:29 +00:00
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:
1 parent
a5912b8b82
commit
f83518bfd7
12 files changed
+12
-28
No files matched your search
@@ -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)) {
|
||||
|
||||
Reference in new issue
Block a user