diff --git a/Cargo.toml b/Cargo.toml index 900448f7..92064c25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,10 @@ spans = ["wasm-bindgen-macro/spans"] std = [] serde-serialize = ["serde", "serde_json", "std"] +# This is only for debugging wasm-bindgen! No stability guarantees, so enable +# this at your own peril! +xxx_debug_only_print_generated_code = ["wasm-bindgen-macro/xxx_debug_only_print_generated_code"] + [dependencies] wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.11" } serde = { version = "1.0", optional = true } diff --git a/crates/macro/Cargo.toml b/crates/macro/Cargo.toml index d8562edf..038a0666 100644 --- a/crates/macro/Cargo.toml +++ b/crates/macro/Cargo.toml @@ -15,6 +15,7 @@ proc-macro = true [features] spans = ["proc-macro2/nightly", "wasm-bindgen-backend/spans"] +xxx_debug_only_print_generated_code = [] [dependencies] syn = { version = '0.14', features = ['full'] } diff --git a/crates/macro/src/lib.rs b/crates/macro/src/lib.rs old mode 100644 new mode 100755 index 772abd7c..3b787dc8 --- a/crates/macro/src/lib.rs +++ b/crates/macro/src/lib.rs @@ -20,7 +20,9 @@ pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream { program.push_item(item, Some(opts), &mut ret); program.to_tokens(&mut ret); - // println!("{}", ret); + if cfg!(feature = "xxx_debug_only_print_generated_code") { + println!("{}", ret); + } ret.into() }