Separate node kind for bindings inside var (#4822)

This is a step toward making binding pattern handling more robust, by
removing its reliance on the node stack for context.
This commit is contained in:
Geoff Romer
2025-01-21 20:15:19 +00:00
committed by GitHub
parent 4f024410f7
commit 943acf1ec2
159 changed files with 356 additions and 367 deletions
+4 -3
View File
@@ -8,11 +8,12 @@
namespace Carbon::Parse {
auto HandlePattern(Context& context) -> void {
context.PopAndDiscardState();
auto state = context.PopState();
if (context.PositionKind() == Lex::TokenKind::OpenParen) {
context.PushState(State::PatternListAsTuple);
context.PushStateForPattern(State::PatternListAsTuple,
state.in_var_pattern);
} else {
context.PushState(State::BindingPattern);
context.PushStateForPattern(State::BindingPattern, state.in_var_pattern);
}
}