1
0
mirror of https://github.com/fluencelabs/wasm-bindgen synced 2025-07-25 00:51:57 +00:00

Ensure internal exported_classes map is consistent

Throw it in an `Option` and then `take()` it when we consume it to
ensure that future calls to insert data into it panic instead of
producing inconsistent JS.
This commit is contained in:
Alex Crichton
2019-01-14 13:11:07 -08:00
parent c0ddabcca1
commit b21489368c
2 changed files with 13 additions and 11 deletions
crates/cli-support/src

@@ -196,16 +196,15 @@ impl Bindgen {
let (js, ts) = {
let mut cx = js::Context {
globals: String::new(),
globals_written: false,
imports: String::new(),
imports_post: String::new(),
footer: String::new(),
typescript: format!("/* tslint:disable */\n"),
exposed_globals: Default::default(),
exposed_globals: Some(Default::default()),
required_internal_exports: Default::default(),
imported_names: Default::default(),
imported_identifiers: Default::default(),
exported_classes: Default::default(),
exported_classes: Some(Default::default()),
config: &self,
module: &mut module,
function_table_needed: false,