mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-27 20:15:14 +03:00
Add support for partial namespaces
This commit is contained in:
parent
a23fa03ad0
commit
df1342398d
@ -189,8 +189,7 @@ impl<'src> WebidlParse<'src, ()> for weedle::Definition<'src> {
|
||||
namespace.webidl_parse(program, first_pass, ())?
|
||||
}
|
||||
weedle::Definition::PartialNamespace(namespace) => {
|
||||
// TODO
|
||||
warn!("Unsupported WebIDL definition: {:?}", self)
|
||||
namespace.webidl_parse(program, first_pass, ())?
|
||||
}
|
||||
// TODO
|
||||
weedle::Definition::Callback(..)
|
||||
@ -832,6 +831,38 @@ impl<'src> WebidlParse<'src, ()> for weedle::NamespaceDefinition<'src> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'src> WebidlParse<'src, ()> for weedle::PartialNamespaceDefinition<'src> {
|
||||
fn webidl_parse(
|
||||
&'src self,
|
||||
program: &mut backend::ast::Program,
|
||||
first_pass: &FirstPassRecord<'src>,
|
||||
(): (),
|
||||
) -> Result<()> {
|
||||
if util::is_chrome_only(&self.attributes) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let rust_name = rust_ident(self.identifier.0.to_snake_case().as_str());
|
||||
|
||||
if !first_pass.namespaces.contains_key(self.identifier.0) {
|
||||
warn!(
|
||||
"Partial namespace {} missing non-partial namespace",
|
||||
self.identifier.0
|
||||
);
|
||||
}
|
||||
|
||||
let namespace_names = NamespaceNames {
|
||||
rust_name: &rust_name,
|
||||
js_name: &self.identifier.0,
|
||||
};
|
||||
for member in &self.members.body {
|
||||
member.webidl_parse(program, first_pass, namespace_names)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'src> WebidlParse<'src, &'src weedle::NamespaceDefinition<'src>> for ExtendedAttribute<'src> {
|
||||
fn webidl_parse(
|
||||
&'src self,
|
||||
|
Loading…
Reference in New Issue
Block a user