mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Clean up some misc toolchain braced inits. (#4013)
Following up on #4012 and #4009, clean scattered cases which could be making better use of designated initializers.
This commit is contained in:
@@ -26,7 +26,8 @@ auto ScopeStack::Push(SemIR::InstId scope_inst_id, SemIR::NameScopeId scope_id,
|
||||
.lexical_lookup_has_load_error =
|
||||
LexicalLookupHasLoadError() || lexical_lookup_has_load_error});
|
||||
if (scope_id.is_valid()) {
|
||||
non_lexical_scope_stack_.push_back({next_scope_index_, scope_id});
|
||||
non_lexical_scope_stack_.push_back(
|
||||
{.scope_index = next_scope_index_, .name_scope_id = scope_id});
|
||||
}
|
||||
|
||||
// TODO: Handle this case more gracefully.
|
||||
@@ -145,7 +146,8 @@ auto ScopeStack::SetReturnedVarOrGetExisting(SemIR::InstId inst_id)
|
||||
|
||||
auto ScopeStack::Suspend() -> SuspendedScope {
|
||||
CARBON_CHECK(!scope_stack_.empty()) << "No scope to suspend";
|
||||
SuspendedScope result = {scope_stack_.pop_back_val(), {}};
|
||||
SuspendedScope result = {.entry = scope_stack_.pop_back_val(),
|
||||
.suspended_lookups = {}};
|
||||
if (result.entry.scope_id.is_valid()) {
|
||||
non_lexical_scope_stack_.pop_back();
|
||||
}
|
||||
@@ -167,8 +169,8 @@ auto ScopeStack::Restore(SuspendedScope scope) -> void {
|
||||
lexical_lookup_.Restore(std::move(entry), scope.entry.index);
|
||||
}
|
||||
if (scope.entry.scope_id.is_valid()) {
|
||||
non_lexical_scope_stack_.push_back(
|
||||
{scope.entry.index, scope.entry.scope_id});
|
||||
non_lexical_scope_stack_.push_back({.scope_index = scope.entry.index,
|
||||
.name_scope_id = scope.entry.scope_id});
|
||||
}
|
||||
scope_stack_.push_back(std::move(scope.entry));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user