mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-05-10 04:47:15 +00:00
Merge pull request #708 from sendilkumarn/extends-arr
Adds Extends to TypedArrays
This commit is contained in:
commit
190b45d59c
@ -683,8 +683,7 @@ 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, extends = TypedArray)]
|
|
||||||
#[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;
|
||||||
|
|
||||||
@ -914,6 +912,7 @@ extern {
|
|||||||
// Int8Array
|
// Int8Array
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#[wasm_bindgen(extends = Object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub type Int8Array;
|
pub type Int8Array;
|
||||||
|
|
||||||
@ -966,6 +965,7 @@ extern "C" {
|
|||||||
// Int16Array
|
// Int16Array
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#[wasm_bindgen(extends = Object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub type Int16Array;
|
pub type Int16Array;
|
||||||
|
|
||||||
@ -1018,6 +1018,7 @@ extern "C" {
|
|||||||
// Int32Array
|
// Int32Array
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#[wasm_bindgen(extends = Object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub type Int32Array;
|
pub type Int32Array;
|
||||||
|
|
||||||
@ -2539,6 +2540,7 @@ extern {
|
|||||||
// Uint8Array
|
// Uint8Array
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#[wasm_bindgen(extends = Object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub type Uint8Array;
|
pub type Uint8Array;
|
||||||
|
|
||||||
@ -2591,6 +2593,7 @@ extern "C" {
|
|||||||
// Uint8ClampedArray
|
// Uint8ClampedArray
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#[wasm_bindgen(extends = Object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub type Uint8ClampedArray;
|
pub type Uint8ClampedArray;
|
||||||
|
|
||||||
@ -2645,6 +2648,7 @@ extern "C" {
|
|||||||
// Uint16Array
|
// Uint16Array
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#[wasm_bindgen(extends = Object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub type Uint16Array;
|
pub type Uint16Array;
|
||||||
|
|
||||||
@ -2697,6 +2701,7 @@ extern "C" {
|
|||||||
// Uint32Array
|
// Uint32Array
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#[wasm_bindgen(extends = Object)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub type Uint32Array;
|
pub type Uint32Array;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
use wasm_bindgen_test::*;
|
use wasm_bindgen_test::*;
|
||||||
|
use wasm_bindgen::JsCast;
|
||||||
use js_sys::*;
|
use js_sys::*;
|
||||||
|
|
||||||
macro_rules! each {
|
macro_rules! each {
|
||||||
@ -16,6 +17,19 @@ macro_rules! each {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro_rules! test_inheritence {
|
||||||
|
($arr:ident) => ({
|
||||||
|
let arr = $arr::new(&JsValue::undefined());
|
||||||
|
assert!(arr.is_instance_of::<$arr>());
|
||||||
|
let _: &Object = arr.as_ref();
|
||||||
|
assert!(arr.is_instance_of::<Object>());
|
||||||
|
})
|
||||||
|
}
|
||||||
|
#[wasm_bindgen_test]
|
||||||
|
fn inheritence() {
|
||||||
|
each!(test_inheritence);
|
||||||
|
}
|
||||||
|
|
||||||
macro_rules! test_undefined {
|
macro_rules! test_undefined {
|
||||||
($arr:ident) => ({
|
($arr:ident) => ({
|
||||||
let arr = $arr::new(&JsValue::undefined());
|
let arr = $arr::new(&JsValue::undefined());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user