Merge branch 'master' of git://github.com/rustwasm/wasm-bindgen

This commit is contained in:
Frazer McLean
2018-08-18 01:58:11 +02:00
218 changed files with 1311 additions and 2854 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "js-sys"
version = "0.2.1"
version = "0.2.2"
authors = ["The wasm-bindgen Developers"]
readme = "./README.md"
categories = ["wasm"]
@ -18,9 +18,9 @@ test = false
doctest = false
[dependencies]
wasm-bindgen = { path = "../..", version = "0.2.16" }
wasm-bindgen = { path = "../..", version = "0.2.17" }
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
futures = "0.1.20"
wasm-bindgen-test = { path = '../test', version = '=0.2.16' }
wasm-bindgen-futures = { path = '../futures', version = '=0.2.16' }
wasm-bindgen-test = { path = '../test', version = '=0.2.17' }
wasm-bindgen-futures = { path = '../futures', version = '=0.2.17' }

View File

@ -683,8 +683,7 @@ extern "C" {
// Float32Array
#[wasm_bindgen]
extern "C" {
// TODO Uncomment this once TypedArray is added:
// #[wasm_bindgen(extends = Object, extends = TypedArray)]
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type Float32Array;
@ -737,8 +736,7 @@ extern "C" {
// Float64Array
#[wasm_bindgen]
extern "C" {
// TODO Uncomment this once TypedArray is added:
// #[wasm_bindgen(extends = Object, extends = TypedArray)]
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type Float64Array;
@ -914,6 +912,7 @@ extern {
// Int8Array
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type Int8Array;
@ -966,6 +965,7 @@ extern "C" {
// Int16Array
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type Int16Array;
@ -1018,6 +1018,7 @@ extern "C" {
// Int32Array
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type Int32Array;
@ -2539,6 +2540,7 @@ extern {
// Uint8Array
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type Uint8Array;
@ -2591,6 +2593,7 @@ extern "C" {
// Uint8ClampedArray
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type Uint8ClampedArray;
@ -2645,6 +2648,7 @@ extern "C" {
// Uint16Array
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type Uint16Array;
@ -2697,6 +2701,7 @@ extern "C" {
// Uint32Array
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type Uint32Array;

View File

@ -8,6 +8,7 @@ fn range_error() {
let error = RangeError::new("out of range yo");
assert!(error.is_instance_of::<RangeError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<Object>());
let base: &Error = error.as_ref();
assert_eq!(JsValue::from(base.message()), "out of range yo");

View File

@ -8,6 +8,7 @@ fn reference_error() {
let error = ReferenceError::new("bad reference, fool");
assert!(error.is_instance_of::<ReferenceError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<Object>());
let base: &Error = error.as_ref();
assert_eq!(JsValue::from(base.message()), "bad reference, fool");

View File

@ -8,6 +8,7 @@ fn syntax_error() {
let error = SyntaxError::new("msg");
assert!(error.is_instance_of::<SyntaxError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<Object>());
let base: &Error = error.as_ref();
assert_eq!(JsValue::from(base.message()), "msg");

View File

@ -8,6 +8,7 @@ fn type_error() {
let error = TypeError::new("msg");
assert!(error.is_instance_of::<TypeError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<Object>());
let base: &Error = error.as_ref();
assert_eq!(JsValue::from(base.message()), "msg");

View File

@ -1,5 +1,6 @@
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
use wasm_bindgen::JsCast;
use js_sys::*;
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 {
($arr:ident) => ({
let arr = $arr::new(&JsValue::undefined());

View File

@ -8,6 +8,7 @@ fn uri_error() {
let error = UriError::new("msg");
assert!(error.is_instance_of::<UriError>());
assert!(error.is_instance_of::<Error>());
assert!(error.is_instance_of::<Object>());
let base: &Error = error.as_ref();
assert_eq!(JsValue::from(base.message()), "msg");