mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-13 04:51:23 +00:00
@ -618,6 +618,14 @@ impl Import {
|
||||
}
|
||||
|
||||
impl ImportKind {
|
||||
pub fn fits_on_impl(&self) -> bool {
|
||||
match *self {
|
||||
ImportKind::Function(_) => true,
|
||||
ImportKind::Static(_) => false,
|
||||
ImportKind::Type(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn shared(&self) -> shared::ImportKind {
|
||||
match *self {
|
||||
ImportKind::Function(ref f) => shared::ImportKind::Function(f.shared()),
|
||||
|
@ -44,14 +44,16 @@ impl ToTokens for ast::Program {
|
||||
}
|
||||
}
|
||||
for i in self.imports.iter() {
|
||||
match i.js_namespace {
|
||||
Some(ns) if types.contains(&ns) => {
|
||||
DescribeImport(&i.kind).to_tokens(tokens);
|
||||
|
||||
if let Some(ns) = i.js_namespace {
|
||||
if types.contains(&ns) && i.kind.fits_on_impl() {
|
||||
let kind = &i.kind;
|
||||
(quote! { impl #ns { #kind } }).to_tokens(tokens);
|
||||
}
|
||||
_ => i.kind.to_tokens(tokens),
|
||||
}
|
||||
DescribeImport(&i.kind).to_tokens(tokens);
|
||||
|
||||
i.kind.to_tokens(tokens);
|
||||
}
|
||||
for e in self.enums.iter() {
|
||||
e.to_tokens(tokens);
|
||||
|
Reference in New Issue
Block a user