WebIDL: Handle Invalid Enum Returns (#477)

* move ImportEnum attributes to a property

* borrow from_js_value argument

* make WebIDL enums non-exhaustive

* add more tests for WebIDL enums
This commit is contained in:
Stephan Wolski
2018-07-23 11:04:28 -04:00
committed by Alex Crichton
parent 5fddcf3868
commit b3ee71c20b
4 changed files with 144 additions and 20 deletions

View File

@ -14,7 +14,9 @@ extern crate heck;
#[macro_use]
extern crate log;
extern crate proc_macro2;
#[macro_use]
extern crate quote;
#[macro_use]
extern crate syn;
extern crate wasm_bindgen_backend as backend;
extern crate webidl;
@ -640,6 +642,7 @@ impl<'a> WebidlParse<()> for webidl::ast::Enum {
.map(|v| rust_ident(v.to_camel_case().as_str()))
.collect(),
variant_values: self.variants.clone(),
rust_attrs: vec![parse_quote!(#[derive(Copy, Clone, PartialEq, Debug)])],
}),
});