Merge pull request #723 from mstallmo/add-extends-to-js-sys

Add extends attributes for js_sys:Generator
This commit is contained in:
Alex Crichton 2018-08-18 22:09:16 -07:00 committed by GitHub
commit 3697ddf4c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -885,6 +885,7 @@ impl Function {
// Generator
#[wasm_bindgen]
extern {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type Generator;

View File

@ -1,5 +1,6 @@
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
use wasm_bindgen::JsCast;
use js_sys::*;
#[wasm_bindgen(module = "tests/wasm/Generator.js")]
@ -56,3 +57,10 @@ fn throw() {
assert!(next.value().is_undefined());
assert!(next.done());
}
#[wasm_bindgen_test]
fn generator_inheritance() {
let gen = dummy_generator();
assert!(gen.is_instance_of::<Object>());
}