mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
refactor(data_structures): add debug assertion to SparseStack (#6218)
Just add an additional debug assert.
This commit is contained in:
parent
adc538141c
commit
61805fd3f2
1 changed files with 1 additions and 0 deletions
|
|
@ -175,6 +175,7 @@ impl<T> SparseStack<T> {
|
|||
self.values.push(init());
|
||||
}
|
||||
|
||||
debug_assert!(!self.values.is_empty());
|
||||
// SAFETY: Last `self.has_values` is only `true` if there's a corresponding value in `self.values`.
|
||||
// This invariant is maintained in `push`, `pop`, `take_last`, and `last_or_init`.
|
||||
// Here either last `self.has_values` was already `true`, or it's just been set to `true`
|
||||
|
|
|
|||
Loading…
Reference in a new issue