Track the start of a signature more accurately (#6760)

This change ensures that a function signature always starts with an
`IdentifierNameMaybeBeforeSignature` node (renamed from
`IdentifierNameBeforeParams`), even in the case of function declarations
like `fn F -> T` that have no parameter list. As a consequence, this
ensures that we push new entries onto `pattern_block_stack` and
`full_pattern_stack` when we start processing the function signature.
This commit is contained in:
Geoff Romer
2026-02-23 22:46:03 +00:00
committed by GitHub
parent 375a736c42
commit 4a0cf6c1fb
282 changed files with 1041 additions and 1039 deletions
+2 -2
View File
@@ -67,10 +67,10 @@ auto HandleChoiceAlternative(Context& context) -> void {
}
if (context.PositionIs(Lex::TokenKind::OpenParen)) {
context.AddLeafNode(NodeKind::IdentifierNameBeforeParams, *token);
context.AddLeafNode(NodeKind::IdentifierNameMaybeBeforeSignature, *token);
context.PushState(StateKind::PatternListAsExplicit);
} else {
context.AddLeafNode(NodeKind::IdentifierNameNotBeforeParams, *token);
context.AddLeafNode(NodeKind::IdentifierNameNotBeforeSignature, *token);
}
}