mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-29 21:11:33 +03:00
Add basic support for [NoInterfaceObject] attribute (#497)
This commit is contained in:
parent
a05d930a38
commit
478e3fcedf
@ -244,6 +244,10 @@ impl WebidlParse<()> for webidl::ast::NonPartialInterface {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if util::is_no_interface_object(&self.extended_attributes) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
program.imports.push(backend::ast::Import {
|
||||
module: None,
|
||||
version: None,
|
||||
|
@ -385,16 +385,24 @@ impl<'a> FirstPassRecord<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// ChromeOnly is for things that are only exposed to priveleged code in Firefox.
|
||||
pub fn is_chrome_only(ext_attrs: &[Box<ExtendedAttribute>]) -> bool {
|
||||
fn has_named_attribute(ext_attrs: &[Box<ExtendedAttribute>], attribute: &str) -> bool {
|
||||
ext_attrs.iter().any(|attr| match &**attr {
|
||||
ExtendedAttribute::NoArguments(webidl::ast::Other::Identifier(name)) => {
|
||||
name == "ChromeOnly"
|
||||
name == attribute
|
||||
}
|
||||
_ => false,
|
||||
})
|
||||
}
|
||||
|
||||
/// ChromeOnly is for things that are only exposed to privileged code in Firefox.
|
||||
pub fn is_chrome_only(ext_attrs: &[Box<ExtendedAttribute>]) -> bool {
|
||||
has_named_attribute(ext_attrs, "ChromeOnly")
|
||||
}
|
||||
|
||||
pub fn is_no_interface_object(ext_attrs: &[Box<ExtendedAttribute>]) -> bool {
|
||||
has_named_attribute(ext_attrs, "NoInterfaceObject")
|
||||
}
|
||||
|
||||
pub fn is_structural(attrs: &[Box<ExtendedAttribute>]) -> bool {
|
||||
attrs.iter().any(|attr| match &**attr {
|
||||
ExtendedAttribute::NoArguments(webidl::ast::Other::Identifier(name)) => {
|
||||
|
Loading…
Reference in New Issue
Block a user