diff --git a/crates/backend/Cargo.toml b/crates/backend/Cargo.toml index 7ba51b66b..7b9f5efe3 100644 --- a/crates/backend/Cargo.toml +++ b/crates/backend/Cargo.toml @@ -17,5 +17,5 @@ spans = ["proc-macro2/nightly"] quote = '0.6' proc-macro2 = "0.4" wasm-bindgen-shared = { path = "../shared", version = "=0.2.11" } -syn = { version = '0.14', features = ['full', 'visit-mut'] } +syn = { version = '0.14', features = ['extra-traits', 'full', 'visit-mut'] } serde_json = "1.0" diff --git a/crates/backend/src/ast.rs b/crates/backend/src/ast.rs index b047154ff..add3ce191 100644 --- a/crates/backend/src/ast.rs +++ b/crates/backend/src/ast.rs @@ -3,7 +3,7 @@ use quote::ToTokens; use shared; use syn; -#[derive(Default)] +#[derive(Debug, Default)] pub struct Program { pub exports: Vec, pub imports: Vec, @@ -11,6 +11,7 @@ pub struct Program { pub structs: Vec, } +#[derive(Debug)] pub struct Export { pub class: Option, pub method: bool, @@ -19,6 +20,7 @@ pub struct Export { pub function: Function, } +#[derive(Debug)] pub struct Import { pub module: Option, pub version: Option, @@ -26,12 +28,14 @@ pub struct Import { pub kind: ImportKind, } +#[derive(Debug)] pub enum ImportKind { Function(ImportFunction), Static(ImportStatic), Type(ImportType), } +#[derive(Debug)] pub struct ImportFunction { pub function: Function, pub rust_name: Ident, @@ -39,12 +43,14 @@ pub struct ImportFunction { pub shim: Ident, } +#[derive(Debug)] pub enum ImportFunctionKind { Method { class: String, ty: syn::Type }, JsConstructor { class: String, ty: syn::Type }, Normal, } +#[derive(Debug)] pub struct ImportStatic { pub vis: syn::Visibility, pub ty: syn::Type, @@ -53,11 +59,13 @@ pub struct ImportStatic { pub js_name: Ident, } +#[derive(Debug)] pub struct ImportType { pub vis: syn::Visibility, pub name: Ident, } +#[derive(Debug)] pub struct Function { pub name: Ident, pub arguments: Vec, @@ -68,11 +76,13 @@ pub struct Function { pub rust_vis: syn::Visibility, } +#[derive(Debug)] pub struct Struct { pub name: Ident, pub fields: Vec, } +#[derive(Debug)] pub struct StructField { pub opts: BindgenAttrs, pub name: Ident, @@ -82,24 +92,26 @@ pub struct StructField { pub setter: Ident, } +#[derive(Debug)] pub struct Enum { pub name: Ident, pub variants: Vec, } +#[derive(Debug)] pub struct Variant { pub name: Ident, pub value: u32, } -#[derive(Copy, Clone)] +#[derive(Copy, Clone, Debug)] pub enum TypeKind { ByRef, ByMutRef, ByValue, } -#[derive(Copy, Clone)] +#[derive(Copy, Clone, Debug)] pub enum TypeLocation { ImportArgument, ImportRet, @@ -757,7 +769,7 @@ impl StructField { } } -#[derive(Default)] +#[derive(Debug, Default)] pub struct BindgenAttrs { attrs: Vec, } @@ -918,7 +930,7 @@ impl syn::synom::Synom for BindgenAttrs { )); } -#[derive(PartialEq)] +#[derive(Debug, PartialEq)] enum BindgenAttr { Catch, Constructor, diff --git a/crates/backend/src/lib.rs b/crates/backend/src/lib.rs old mode 100644 new mode 100755 index ab9d46ac0..f3f24428e --- a/crates/backend/src/lib.rs +++ b/crates/backend/src/lib.rs @@ -1,4 +1,5 @@ #![recursion_limit = "256"] +#![deny(missing_debug_implementations)] extern crate proc_macro2; #[macro_use]