Skip to content

Commit b1c0854

Browse files
authored
Add blank lines to group case with the above offset increment in InstNamer::GetScopeIdOffset() (#6165)
This would hopefully help prevent bugs like the one fixed in #6151. See refactoring discussion in #6159.
1 parent 5f56128 commit b1c0854

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

toolchain/sem_ir/inst_namer.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,30 +130,39 @@ auto InstNamer::GetScopeIdOffset(ScopeIdTypeEnum id_enum) const -> int {
130130
switch (id_enum) {
131131
case ScopeIdTypeEnum::None:
132132
// `None` will be getting a full count of scopes.
133+
133134
offset += sem_ir_->associated_constants().size();
134135
[[fallthrough]];
135136
case ScopeIdTypeEnum::For<AssociatedConstantId>:
137+
136138
offset += sem_ir_->classes().size();
137139
[[fallthrough]];
138140
case ScopeIdTypeEnum::For<ClassId>:
141+
139142
offset += sem_ir_->cpp_overload_sets().size();
140143
[[fallthrough]];
141144
case ScopeIdTypeEnum::For<CppOverloadSetId>:
145+
142146
offset += sem_ir_->functions().size();
143147
[[fallthrough]];
144148
case ScopeIdTypeEnum::For<FunctionId>:
149+
145150
offset += sem_ir_->impls().size();
146151
[[fallthrough]];
147152
case ScopeIdTypeEnum::For<ImplId>:
153+
148154
offset += sem_ir_->interfaces().size();
149155
[[fallthrough]];
150156
case ScopeIdTypeEnum::For<InterfaceId>:
157+
151158
offset += sem_ir_->specific_interfaces().size();
152159
[[fallthrough]];
153160
case ScopeIdTypeEnum::For<SpecificInterfaceId>:
161+
154162
offset += sem_ir_->vtables().size();
155163
[[fallthrough]];
156164
case ScopeIdTypeEnum::For<VtableId>:
165+
157166
// All type-specific scopes are offset by `FirstEntityScope`.
158167
offset += static_cast<int>(ScopeId::FirstEntityScope);
159168
return offset;

0 commit comments

Comments
 (0)