Add basic support for [NoInterfaceObject] attribute (#497)

This commit is contained in:
Ben Merritt 2018-07-17 22:23:17 -07:00 committed by Alex Crichton
parent a05d930a38
commit 478e3fcedf
2 changed files with 15 additions and 3 deletions

View File

@ -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,

View File

@ -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)) => {