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