mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-18 07:21:24 +00:00
webidl: All interfaces implicitly extend Object
This information is embedded within the algorithm for constructing interfaces and their prototypes in the section for ECMAScript glue in the WebIDL spec... This really *should* make the `wasm_bindgen_backend::ast::ImportType::extends` member from a `Vec<Ident>` into a `Vec<syn::Path>` so that we could use `js_sys::Object` in the extends field, but that is a huge pain because then the `ImportedTypes` trait needs to be changed, and all of its implementers, etc...
This commit is contained in:
@ -120,7 +120,10 @@ fn parse(webidl_source: &str, allowed_types: Option<&[&str]>)
|
||||
// `AsRef` and such implementations.
|
||||
for import in program.imports.iter_mut() {
|
||||
if let backend::ast::ImportKind::Type(t) = &mut import.kind {
|
||||
t.extends.retain(|n| filter(&n.to_string()));
|
||||
t.extends.retain(|n| {
|
||||
first_pass_record.builtin_idents.contains(n) ||
|
||||
filter(&n.to_string())
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -445,6 +448,7 @@ impl<'src> FirstPassRecord<'src> {
|
||||
instanceof_shim: format!("__widl_instanceof_{}", name),
|
||||
extends: self.all_superclasses(name)
|
||||
.map(|name| Ident::new(&name, Span::call_site()))
|
||||
.chain(Some(Ident::new("Object", Span::call_site())))
|
||||
.collect(),
|
||||
};
|
||||
self.append_required_features_doc(&import_type, &mut doc_comment);
|
||||
|
Reference in New Issue
Block a user