Alex Crichton aa348f963f
Bump to 0.2.12 (#515)
* Bump to 0.2.12

* Update all version numbers and deps
* Update all listed authors to `["The wasm-bindgen Developers"]`
* Update `repository` links to specific paths for each crate
* Update `homepage` links to the online book
* Update all links away from `alexcrichton/wasm-bindgen`
* Add `#[doc]` directives for HTML URLs

* Update more version requirements

* Fill out CHANGELOG
2018-07-19 14:57:04 -05:00

35 lines
971 B
Rust
Executable File

#![doc(html_root_url = "https://docs.rs/wasm-bindgen-macro/0.2")]
extern crate proc_macro;
extern crate proc_macro2;
extern crate quote;
extern crate wasm_bindgen_shared as shared;
#[macro_use]
extern crate syn;
extern crate wasm_bindgen_backend as backend;
use proc_macro::TokenStream;
use quote::ToTokens;
mod parser;
use parser::MacroParse;
#[proc_macro_attribute]
pub fn wasm_bindgen(attr: TokenStream, input: TokenStream) -> TokenStream {
let item = syn::parse::<syn::Item>(input.clone()).expect("expected a valid Rust item");
let opts =
syn::parse::<parser::BindgenAttrs>(attr).expect("invalid arguments to #[wasm_bindgen]");
let mut ret = proc_macro2::TokenStream::new();
let mut program = backend::ast::Program::default();
item.macro_parse(&mut program, (Some(opts), &mut ret));
program.to_tokens(&mut ret);
if cfg!(feature = "xxx_debug_only_print_generated_code") {
println!("{}", ret);
}
ret.into()
}