Skip to content

Commit

Permalink
refactor(allocator): add impl GetAddress for Address (oxc-project#6891
Browse files Browse the repository at this point in the history
)

This allows passing an `Address` to methods like `StatementInjectorStore::insert_before` if you want to.
  • Loading branch information
overlookmotel committed Oct 25, 2024
1 parent 262b2ed commit adb5039
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/oxc_allocator/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ impl<'a, T> GetAddress for Box<'a, T> {
Address::from_ptr(ptr::addr_of!(**self))
}
}

impl GetAddress for Address {
/// Address of an `Address` is itself.
#[inline]
fn address(&self) -> Address {
*self
}
}

0 comments on commit adb5039

Please sign in to comment.