mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-19 02:10:34 +00:00
Refactor state construction and change how the decl loop makes state. (#3467)
Building on #3463. The PushState+PopState to construct a state feels worth cleanup. The rest is just kind of making it easier to do without adding another PushState overload.
This commit is contained in:
1 parent
3b0923c81d
commit
50071532fe
5 files changed
+62
-58
No files matched your search
@@ -12,15 +12,15 @@ auto HandleBindingPattern(Context& context) -> void {
|
||||
// Parameters may have keywords prefixing the pattern. They become the parent
|
||||
// for the full BindingPattern.
|
||||
if (auto token = context.ConsumeIf(Lex::TokenKind::Template)) {
|
||||
context.PushState(Context::StateStackEntry(
|
||||
State::BindingPatternTemplate, PrecedenceGroup::ForTopLevelExpr(),
|
||||
PrecedenceGroup::ForTopLevelExpr(), *token, state.subtree_start));
|
||||
context.PushState({.state = State::BindingPatternTemplate,
|
||||
.token = *token,
|
||||
.subtree_start = state.subtree_start});
|
||||
}
|
||||
|
||||
if (auto token = context.ConsumeIf(Lex::TokenKind::Addr)) {
|
||||
context.PushState(Context::StateStackEntry(
|
||||
State::BindingPatternAddress, PrecedenceGroup::ForTopLevelExpr(),
|
||||
PrecedenceGroup::ForTopLevelExpr(), *token, state.subtree_start));
|
||||
context.PushState({.state = State::BindingPatternAddress,
|
||||
.token = *token,
|
||||
.subtree_start = state.subtree_start});
|
||||
}
|
||||
|
||||
// Handle an invalid pattern introducer for parameters and variables.
|
||||
|
||||
Reference in new issue
Block a user