js-sys: Add extends attributes for js_sys::Float64Array

address review comments

add review comments
This commit is contained in:
Sendil Kumar
2018-08-14 19:39:02 +02:00
parent d9fbc48daa
commit af9ecac296
2 changed files with 3 additions and 17 deletions

View File

@ -683,7 +683,6 @@ extern "C" {
// Float32Array // Float32Array
#[wasm_bindgen] #[wasm_bindgen]
extern "C" { extern "C" {
// TODO Uncomment this once TypedArray is added:
#[wasm_bindgen(extends = Object)] #[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub type Float32Array; pub type Float32Array;
@ -737,8 +736,7 @@ extern "C" {
// Float64Array // Float64Array
#[wasm_bindgen] #[wasm_bindgen]
extern "C" { extern "C" {
// TODO Uncomment this once TypedArray is added: #[wasm_bindgen(extends = Object)]
// #[wasm_bindgen(extends = Object, extends = TypedArray)]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub type Float64Array; pub type Float64Array;

View File

@ -13,6 +13,7 @@ macro_rules! each {
$m!(Int16Array); $m!(Int16Array);
$m!(Int32Array); $m!(Int32Array);
$m!(Float32Array); $m!(Float32Array);
$m!(Float64Array);
) )
} }
@ -20,6 +21,7 @@ macro_rules! test_inheritence {
($arr:ident) => ({ ($arr:ident) => ({
let arr = $arr::new(&JsValue::undefined()); let arr = $arr::new(&JsValue::undefined());
assert!(arr.is_instance_of::<$arr>()); assert!(arr.is_instance_of::<$arr>());
let _: &Object = arr.as_ref();
assert!(arr.is_instance_of::<Object>()); assert!(arr.is_instance_of::<Object>());
}) })
} }
@ -28,20 +30,6 @@ fn inheritence() {
each!(test_inheritence); each!(test_inheritence);
} }
macro_rules! each {
($m:ident) => (
$m!(Uint8Array);
$m!(Uint8ClampedArray);
$m!(Uint16Array);
$m!(Uint32Array);
$m!(Int8Array);
$m!(Int16Array);
$m!(Int32Array);
$m!(Float32Array);
$m!(Float64Array);
)
}
macro_rules! test_undefined { macro_rules! test_undefined {
($arr:ident) => ({ ($arr:ident) => ({
let arr = $arr::new(&JsValue::undefined()); let arr = $arr::new(&JsValue::undefined());