mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-12-28 10:09:25 -05:00
Use &mut Isolate
in Object::wrap and Object::unwrap (#1518)
This commit is contained in:
parent
0c7be7285c
commit
8820e5b4ee
1 changed files with 4 additions and 5 deletions
|
@ -706,14 +706,14 @@ impl Object {
|
||||||
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub unsafe fn wrap<const TAG: u16, T: GarbageCollected>(
|
pub unsafe fn wrap<const TAG: u16, T: GarbageCollected>(
|
||||||
scope: &mut HandleScope,
|
isolate: &mut Isolate,
|
||||||
wrapper: Local<Object>,
|
wrapper: Local<Object>,
|
||||||
value: &impl GetRustObj<T>,
|
value: &impl GetRustObj<T>,
|
||||||
) {
|
) {
|
||||||
// TODO: use a const assert once const expressions are stable
|
// TODO: use a const assert once const expressions are stable
|
||||||
assert!(TAG < LAST_TAG);
|
assert!(TAG < LAST_TAG);
|
||||||
let ptr = value.get_rust_obj();
|
let ptr = value.get_rust_obj();
|
||||||
unsafe { v8__Object__Wrap(scope.get_isolate_ptr(), &*wrapper, ptr, TAG) }
|
unsafe { v8__Object__Wrap(isolate as *mut _, &*wrapper, ptr, TAG) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Unwraps a JS wrapper object.
|
/// Unwraps a JS wrapper object.
|
||||||
|
@ -724,13 +724,12 @@ impl Object {
|
||||||
/// the stack, or moved into one of the Persistent types.
|
/// the stack, or moved into one of the Persistent types.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub unsafe fn unwrap<const TAG: u16, T: GarbageCollected>(
|
pub unsafe fn unwrap<const TAG: u16, T: GarbageCollected>(
|
||||||
scope: &mut HandleScope,
|
isolate: &mut Isolate,
|
||||||
wrapper: Local<Object>,
|
wrapper: Local<Object>,
|
||||||
) -> Member<T> {
|
) -> Member<T> {
|
||||||
// TODO: use a const assert once const expressions are stable
|
// TODO: use a const assert once const expressions are stable
|
||||||
assert!(TAG < LAST_TAG);
|
assert!(TAG < LAST_TAG);
|
||||||
let ptr =
|
let ptr = unsafe { v8__Object__Unwrap(isolate as *mut _, &*wrapper, TAG) };
|
||||||
unsafe { v8__Object__Unwrap(scope.get_isolate_ptr(), &*wrapper, TAG) };
|
|
||||||
Member::new(ptr)
|
Member::new(ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue