Skip to content

Commit

Permalink
Revert "add & use NonEmptyStack::first"
Browse files Browse the repository at this point in the history
This reverts commit 154d4c5.
  • Loading branch information
branchseer committed Jan 25, 2025
1 parent 154d4c5 commit 2bf224c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
14 changes: 0 additions & 14 deletions crates/oxc_data_structures/src/stack/non_empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,6 @@ impl<T> NonEmptyStack<T> {
Self { cursor: start, start, end }
}

/// Get reference to first value on stack.
#[inline]
pub fn first(&self) -> &T {
// SAFETY: All methods ensure `self.start` always points to a valid initialized `T`
unsafe { self.start.as_ref() }
}

/// Get mutable reference to first value on stack.
#[inline]
pub fn first_mut(&mut self) -> &mut T {
// SAFETY: All methods ensure `self.start` always points to a valid initialized `T`
unsafe { self.start.as_mut() }
}

/// Get reference to last value on stack.
#[inline]
pub fn last(&self) -> &T {
Expand Down
4 changes: 3 additions & 1 deletion crates/oxc_transformer/src/typescript/enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,9 @@ impl IdentifierReferenceRename<'_, '_> {
// }
// }
// ```
*self.scope_stack.first() == symbol_scope_id
//
// `NonEmptyStack` guarantees that the stack is not empty.
*self.scope_stack.first().unwrap() == symbol_scope_id
// The resolved symbol is declared outside the enum,
// and we have checked that the name exists in previous_enum_members:
//
Expand Down

0 comments on commit 2bf224c

Please sign in to comment.