mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-12-27 01:29:19 -05:00
Remove incorrect uses of Local::from_raw() (#385)
This commit is contained in:
parent
9540732a6a
commit
8213c0e428
2 changed files with 8 additions and 3 deletions
|
@ -5,6 +5,7 @@ use crate::support::int;
|
||||||
use crate::ArrayBuffer;
|
use crate::ArrayBuffer;
|
||||||
use crate::ArrayBufferView;
|
use crate::ArrayBufferView;
|
||||||
use crate::Local;
|
use crate::Local;
|
||||||
|
use crate::ToLocal;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
fn v8__ArrayBufferView__Buffer(
|
fn v8__ArrayBufferView__Buffer(
|
||||||
|
@ -21,8 +22,11 @@ extern "C" {
|
||||||
|
|
||||||
impl ArrayBufferView {
|
impl ArrayBufferView {
|
||||||
/// Returns underlying ArrayBuffer.
|
/// Returns underlying ArrayBuffer.
|
||||||
pub fn buffer<'sc>(&self) -> Option<Local<'sc, ArrayBuffer>> {
|
pub fn buffer<'sc>(
|
||||||
unsafe { Local::from_raw(v8__ArrayBufferView__Buffer(self)) }
|
&self,
|
||||||
|
scope: &'_ mut impl ToLocal<'sc>,
|
||||||
|
) -> Option<Local<'sc, ArrayBuffer>> {
|
||||||
|
unsafe { scope.to_local(v8__ArrayBufferView__Buffer(self)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Size of a view in bytes.
|
/// Size of a view in bytes.
|
||||||
|
|
|
@ -80,7 +80,8 @@ impl StackTrace {
|
||||||
) -> Option<Local<'sc, StackFrame>> {
|
) -> Option<Local<'sc, StackFrame>> {
|
||||||
let isolate = scope.isolate();
|
let isolate = scope.isolate();
|
||||||
unsafe {
|
unsafe {
|
||||||
Local::from_raw(v8__StackTrace__GetFrame(self, isolate, index as u32))
|
let ptr = v8__StackTrace__GetFrame(self, isolate, index as u32);
|
||||||
|
scope.to_local(ptr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue