mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-23 17:51:33 +00:00
Add applying of typedefs, remove generation of type aliases
This commit is contained in:
crates
@ -17,8 +17,6 @@ pub struct Program {
|
||||
pub enums: Vec<Enum>,
|
||||
/// rust structs
|
||||
pub structs: Vec<Struct>,
|
||||
/// rust type aliases
|
||||
pub type_aliases: Vec<TypeAlias>,
|
||||
/// rust consts
|
||||
pub consts: Vec<Const>,
|
||||
}
|
||||
@ -198,13 +196,6 @@ pub enum TypeLocation {
|
||||
ExportRet,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "extra-traits", derive(Debug, PartialEq, Eq))]
|
||||
pub struct TypeAlias {
|
||||
pub vis: syn::Visibility,
|
||||
pub dest: Ident,
|
||||
pub src: syn::Type,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "extra-traits", derive(Debug, PartialEq))]
|
||||
pub struct Const {
|
||||
pub vis: syn::Visibility,
|
||||
|
@ -64,9 +64,6 @@ impl TryToTokens for ast::Program {
|
||||
for e in self.enums.iter() {
|
||||
e.to_tokens(tokens);
|
||||
}
|
||||
for a in self.type_aliases.iter() {
|
||||
a.to_tokens(tokens);
|
||||
}
|
||||
for c in self.consts.iter() {
|
||||
c.to_tokens(tokens);
|
||||
}
|
||||
@ -983,18 +980,6 @@ impl ToTokens for ast::ImportStatic {
|
||||
}
|
||||
}
|
||||
|
||||
impl ToTokens for ast::TypeAlias {
|
||||
fn to_tokens(&self, into: &mut TokenStream) {
|
||||
let vis = &self.vis;
|
||||
let dest = &self.dest;
|
||||
let src = &self.src;
|
||||
(quote! {
|
||||
#[allow(non_camel_case_types)]
|
||||
#vis type #dest = #src;
|
||||
}).to_tokens(into);
|
||||
}
|
||||
}
|
||||
|
||||
impl ToTokens for ast::Const {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
use ast::ConstValue::*;
|
||||
|
@ -83,7 +83,6 @@ impl ImportedTypes for ast::Program {
|
||||
F: FnMut(&Ident, ImportedTypeKind),
|
||||
{
|
||||
self.imports.imported_types(f);
|
||||
self.type_aliases.imported_types(f);
|
||||
self.consts.imported_types(f);
|
||||
}
|
||||
}
|
||||
@ -290,15 +289,6 @@ impl ImportedTypes for ast::ImportEnum {
|
||||
}
|
||||
}
|
||||
|
||||
impl ImportedTypes for ast::TypeAlias {
|
||||
fn imported_types<F>(&self, f: &mut F)
|
||||
where
|
||||
F: FnMut(&Ident, ImportedTypeKind),
|
||||
{
|
||||
f(&self.dest, ImportedTypeKind::Reference);
|
||||
}
|
||||
}
|
||||
|
||||
impl ImportedTypes for ast::Const {
|
||||
fn imported_types<F>(&self, f: &mut F)
|
||||
where
|
||||
@ -322,7 +312,6 @@ impl RemoveUndefinedImports for ast::Program {
|
||||
F: Fn(&Ident) -> bool,
|
||||
{
|
||||
self.imports.remove_undefined_imports(is_defined);
|
||||
self.type_aliases.remove_undefined_imports(is_defined);
|
||||
self.consts.remove_undefined_imports(is_defined);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user