Skip to content

Commit eea058e

Browse files
committed
Use new proxy abstraction
1 parent 0530adc commit eea058e

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/de.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use rquickjs::{
44
function::This,
55
object::ObjectIter,
66
qjs::{
7-
JS_GetClassID, JS_GetProperty, JS_GetPropertyUint32, JS_GetProxyTarget, JS_IsArray,
8-
JS_IsProxy, JS_TAG_EXCEPTION, JS_VALUE_GET_NORM_TAG,
7+
JS_GetClassID, JS_GetProperty, JS_GetPropertyUint32, JS_TAG_EXCEPTION,
8+
JS_VALUE_GET_NORM_TAG,
99
},
1010
};
1111
use serde::{
@@ -562,18 +562,16 @@ fn is_array_or_proxy_of_array(val: &Value) -> bool {
562562
if val.is_array() {
563563
return true;
564564
}
565-
let ctx = val.ctx().clone();
566565
let mut val = val.clone();
567566
loop {
568-
let is_proxy = unsafe { JS_IsProxy(val.as_raw()) };
569-
if !is_proxy {
567+
let Some(proxy) = val.into_proxy() else {
568+
return false;
569+
};
570+
let Ok(target) = proxy.target() else {
570571
return false;
571-
}
572-
val = unsafe {
573-
let target = JS_GetProxyTarget(ctx.as_raw().as_ptr(), val.as_raw());
574-
Value::from_raw(ctx.clone(), target)
575572
};
576-
if unsafe { JS_IsArray(val.as_raw()) } {
573+
val = target.into_value();
574+
if val.is_array() {
577575
return true;
578576
}
579577
}

0 commit comments

Comments
 (0)