Skip to content

Commit 927077b

Browse files
committed
refactor(sema): avoid decrementing before begin
1 parent 70cb071 commit 927077b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

source/sema.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,8 @@ class sema
323323
// Then look backward to find the first declaration of
324324
// this name that is not deeper (in a nested scope)
325325
// and is in the same function
326-
if (i->position() > t.position()) {
327-
--i;
328-
}
329-
++i;
326+
std::ranges::advance(i, -int(i->position() > t.position()), symbols.cbegin());
327+
std::ranges::advance(i, 1, symbols.cend());
330328
auto reached_type = false;
331329
while (std::ranges::advance(i, -1, symbols.begin()) == 0)
332330
{

0 commit comments

Comments
 (0)