js-sys: Add extends to Reflect

Part of #670
This commit is contained in:
Nick Fitzgerald 2018-09-06 13:42:16 -07:00
parent bfff8661c1
commit 66d155d708
2 changed files with 14 additions and 1 deletions

View File

@ -2128,6 +2128,7 @@ extern {
#[wasm_bindgen]
extern "C" {
#[derive(Clone, Debug)]
#[wasm_bindgen(extends = Object)]
pub type Reflect;
/// The static `Reflect.apply()` method calls a target function with

View File

@ -1,4 +1,4 @@
use wasm_bindgen::prelude::*;
use wasm_bindgen::{JsCast, prelude::*};
use wasm_bindgen_test::*;
use js_sys::*;
@ -180,3 +180,15 @@ fn set_prototype_of() {
let obj = JsValue::from(obj);
assert_eq!(JsValue::from(Reflect::get_prototype_of(&obj)), JsValue::null());
}
#[wasm_bindgen_test]
fn reflect_extends() {
#[wasm_bindgen]
extern {
#[wasm_bindgen(js_name = Reflect)]
static reflect: Reflect;
}
assert!(reflect.is_instance_of::<Object>());
let _: &Object = reflect.as_ref();
}