mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-11-24 06:33:33 +03:00
parent
7ec1511d3d
commit
5df8e20815
@ -143,7 +143,7 @@ pub struct ImportType {
|
||||
pub attrs: Vec<syn::Attribute>,
|
||||
pub doc_comment: Option<String>,
|
||||
pub instanceof_shim: String,
|
||||
pub extends: Vec<Ident>,
|
||||
pub extends: Vec<syn::Path>,
|
||||
pub vendor_prefixes: Vec<Ident>,
|
||||
}
|
||||
|
||||
|
@ -288,7 +288,7 @@ impl ImportedTypes for ast::ImportType {
|
||||
{
|
||||
f(&self.rust_name, ImportedTypeKind::Definition);
|
||||
for class in self.extends.iter() {
|
||||
f(class, ImportedTypeKind::Reference);
|
||||
class.imported_types(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ impl BindgenAttrs {
|
||||
}
|
||||
|
||||
/// Return the list of classes that a type extends
|
||||
fn extends(&self) -> impl Iterator<Item = &Ident> {
|
||||
fn extends(&self) -> impl Iterator<Item = &syn::Path> {
|
||||
self.attrs.iter().filter_map(|a| match a {
|
||||
BindgenAttr::Extends(s) => Some(s),
|
||||
_ => None,
|
||||
@ -232,7 +232,7 @@ pub enum BindgenAttr {
|
||||
Readonly,
|
||||
JsName(String, Span),
|
||||
JsClass(String),
|
||||
Extends(Ident),
|
||||
Extends(syn::Path),
|
||||
VendorPrefix(Ident),
|
||||
Variadic,
|
||||
}
|
||||
@ -292,7 +292,7 @@ impl Parse for BindgenAttr {
|
||||
}
|
||||
if attr == "extends" {
|
||||
input.parse::<Token![=]>()?;
|
||||
return Ok(BindgenAttr::Extends(input.parse::<AnyIdent>()?.0));
|
||||
return Ok(BindgenAttr::Extends(input.parse()?));
|
||||
}
|
||||
if attr == "vendor_prefix" {
|
||||
input.parse::<Token![=]>()?;
|
||||
|
@ -126,8 +126,11 @@ fn parse(webidl_source: &str, allowed_types: Option<&[&str]>) -> Result<Program>
|
||||
// `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| first_pass_record.builtin_idents.contains(n) || filter(&n.to_string()));
|
||||
t.extends.retain(|n| {
|
||||
let ident = &n.segments.last().unwrap().value().ident;
|
||||
first_pass_record.builtin_idents.contains(ident) ||
|
||||
filter(&ident.to_string())
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -515,8 +518,8 @@ impl<'src> FirstPassRecord<'src> {
|
||||
self.append_required_features_doc(&import_type, &mut doc_comment, extra);
|
||||
import_type.extends = self
|
||||
.all_superclasses(name)
|
||||
.map(|name| Ident::new(&name, Span::call_site()))
|
||||
.chain(Some(Ident::new("Object", Span::call_site())))
|
||||
.map(|name| Ident::new(&name, Span::call_site()).into())
|
||||
.chain(Some(Ident::new("Object", Span::call_site()).into()))
|
||||
.collect();
|
||||
import_type.doc_comment = doc_comment;
|
||||
|
||||
|
@ -19,7 +19,7 @@ extern "C" {
|
||||
#[wasm_bindgen(constructor)]
|
||||
fn new() -> JsCast3;
|
||||
|
||||
#[wasm_bindgen(extends = JsCast1, extends = JsCast3)]
|
||||
#[wasm_bindgen(extends = ::jscast::JsCast1, extends = JsCast3)]
|
||||
type JsCast4;
|
||||
#[wasm_bindgen(constructor)]
|
||||
fn new() -> JsCast4;
|
||||
|
Loading…
Reference in New Issue
Block a user