Skip to content

Commit 853238d

Browse files
committed
Clarify != nullptr explicitly to make logic clearer, and add not-empty check
Addresses comment d136153#r142724776
1 parent 37299f2 commit 853238d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

source/sema.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,11 +2449,17 @@ class sema
24492449
}
24502450

24512451
// All the scope-local names stay active for lookup until the end of their scope
2452-
while (current_declarations.back()) {
2452+
while (
2453+
!current_declarations.empty()
2454+
&& current_declarations.back() != nullptr
2455+
)
2456+
{
2457+
current_declarations.pop_back();
2458+
}
2459+
if (!current_declarations.empty()) {
2460+
assert(current_declarations.back() == nullptr); // we're popping a lifetime scope
24532461
current_declarations.pop_back();
24542462
}
2455-
assert(!current_declarations.back()); // we're popping a lifetime scope
2456-
current_declarations.pop_back();
24572463

24582464
indices_of_uses_per_scope.pop_back();
24592465
indices_of_activations_per_scope.pop_back();

0 commit comments

Comments
 (0)