Skip to content

Commit

Permalink
Change iteration behaviour.
Browse files Browse the repository at this point in the history
  • Loading branch information
taalexander committed Mar 25, 2024
1 parent 6445703 commit 1f41c3d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions include/qasm/AST/ASTBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,10 @@ class ASTTokenFactory {
}

static const ASTToken *GetPreviousToken() {
std::map<uint32_t, ASTToken *>::const_reverse_iterator MRI = TFM.rbegin();
if (MRI == TFM.rend())
if (TFM.empty())
return nullptr;

auto PrevMRI = std::prev(MRI);
return PrevMRI == TFM.rend() ? nullptr : (*PrevMRI).second;
return std::prev(TFM.end())->second;
}

static uint32_t GetCurrentIndex() { return TIX; }
Expand Down

0 comments on commit 1f41c3d

Please sign in to comment.