mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Rename Parse::State to Parse::StateKind (#5249)
Also renames variables of that type to match. A follow-up PR will rename `Parse::StateStackEntry` to `Parse::State`. This is more consistent with the naming of similar enums elsewhere in the toolchain, and with the prevailing practice of using `state` rather than e.g. `entry` as the name of a `StateStackEntry`. See also discussion [here](https://discord.com/channels/655572317891461132/963846118964350976/1326280585592700990)
This commit is contained in:
@@ -436,14 +436,14 @@ auto Context::DiagnoseExpectedDeclSemiOrDefinition(Lex::TokenKind expected_kind)
|
||||
// definitions are deferred, such as a class or interface.
|
||||
static auto ParsingInDeferredDefinitionScope(Context& context) -> bool {
|
||||
auto& stack = context.state_stack();
|
||||
if (stack.size() < 2 || stack.back().state != State::DeclScopeLoop) {
|
||||
if (stack.size() < 2 || stack.back().kind != StateKind::DeclScopeLoop) {
|
||||
return false;
|
||||
}
|
||||
auto state = stack[stack.size() - 2].state;
|
||||
return state == State::DeclDefinitionFinishAsClass ||
|
||||
state == State::DeclDefinitionFinishAsImpl ||
|
||||
state == State::DeclDefinitionFinishAsInterface ||
|
||||
state == State::DeclDefinitionFinishAsNamedConstraint;
|
||||
auto kind = stack[stack.size() - 2].kind;
|
||||
return kind == StateKind::DeclDefinitionFinishAsClass ||
|
||||
kind == StateKind::DeclDefinitionFinishAsImpl ||
|
||||
kind == StateKind::DeclDefinitionFinishAsInterface ||
|
||||
kind == StateKind::DeclDefinitionFinishAsNamedConstraint;
|
||||
}
|
||||
|
||||
auto Context::AddFunctionDefinitionStart(Lex::TokenIndex token, bool has_error)
|
||||
@@ -470,7 +470,7 @@ auto Context::AddFunctionDefinition(Lex::TokenIndex token, bool has_error)
|
||||
auto Context::PrintForStackDump(llvm::raw_ostream& output) const -> void {
|
||||
output << "Parser stack:\n";
|
||||
for (auto [i, entry] : llvm::enumerate(state_stack_)) {
|
||||
output << "\t" << i << ".\t" << entry.state;
|
||||
output << "\t" << i << ".\t" << entry.kind;
|
||||
PrintTokenForStackDump(output, entry.token);
|
||||
}
|
||||
output << "\tcursor\tposition_";
|
||||
|
||||
Reference in New Issue
Block a user