mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-20 00:11:23 +00:00
Update with masters and fix PR changes
This commit is contained in:
@ -6,6 +6,7 @@ use heck::SnakeCase;
|
||||
use proc_macro2::Ident;
|
||||
use syn;
|
||||
use webidl;
|
||||
use webidl::ast::ExtendedAttribute;
|
||||
|
||||
fn shared_ref(ty: syn::Type) -> syn::Type {
|
||||
syn::TypeReference {
|
||||
@ -285,3 +286,32 @@ pub fn create_setter(
|
||||
vec![backend::ast::BindgenAttr::Setter(Some(raw_ident(name)))],
|
||||
)
|
||||
}
|
||||
|
||||
/// ChromeOnly is for things that are only exposed to priveleged code in Firefox.
|
||||
pub fn is_chrome_only(ext_attrs: &[Box<ExtendedAttribute>]) -> bool {
|
||||
ext_attrs.iter().any(|external_attribute| {
|
||||
return match &**external_attribute {
|
||||
ExtendedAttribute::ArgumentList(al) => {
|
||||
println!("ArgumentList");
|
||||
al.name == "ChromeOnly"
|
||||
},
|
||||
ExtendedAttribute::Identifier(i) => {
|
||||
println!("Identifier");
|
||||
i.lhs == "ChromeOnly"
|
||||
},
|
||||
ExtendedAttribute::IdentifierList(il) => {
|
||||
println!("IdentifierList");
|
||||
il.lhs == "ChromeOnly"
|
||||
},
|
||||
ExtendedAttribute::NamedArgumentList(nal) => {
|
||||
println!("NamedArgumentList");
|
||||
nal.lhs_name == "ChromeOnly"
|
||||
},
|
||||
ExtendedAttribute::NoArguments(webidl::ast::Other::Identifier(name)) => name == "ChromeOnly",
|
||||
ExtendedAttribute::NoArguments(_na) => {
|
||||
println!("NoArguments");
|
||||
false
|
||||
}
|
||||
};
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user