mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-17 23:11:23 +00:00
Add a feature for printing the macro's generated code (#212)
This commit is contained in:
committed by
Alex Crichton
parent
4c27c349ea
commit
50b8842b95
@ -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 }
|
||||
|
@ -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'] }
|
||||
|
4
crates/macro/src/lib.rs
Normal file → Executable file
4
crates/macro/src/lib.rs
Normal file → Executable file
@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user