Fix some situations with duplicate imports (#589)

* Fix importing the same identifier from two modules

This needed a fix in two locations:

* First the generated descriptor function needed its hash to include the module
  that the import came from in order to generate unique descriptor functions.
* Second the generation of the JS shim needed to handle duplicate identifiers in
  a more uniform fashion, ensuring that imported names didn't clash.

* Fix importing the same name in two modules

Previously two descriptor functions with duplicate symbols were emitted, and now
only one function is emitted by using a global table to keep track of state
across macro invocations.
This commit is contained in:
Alex Crichton
2018-07-30 10:50:43 -07:00
committed by GitHub
parent 7fda07f797
commit d876475ce3
8 changed files with 241 additions and 85 deletions

View File

@ -2,6 +2,8 @@
#![cfg_attr(feature = "extra-traits", deny(missing_debug_implementations))]
#![doc(html_root_url = "https://docs.rs/wasm-bindgen-backend/0.2")]
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
extern crate proc_macro2;