Merge pull request #1544 from ibaryshnikov/master

expose forget to wasm
This commit is contained in:
Alex Crichton 2019-05-20 11:33:10 -05:00 committed by GitHub
commit f23b867179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -249,7 +249,7 @@ impl<'a> Context<'a> {
format!("{}{}\n", export, contents)
} else {
assert_eq!(export_name, definition_name);
format!("{}const {} = {};\n", export, export_name, contents)
format!("{}const {name} = {};\n__exports.{name} = {name};", export, contents, name = export_name)
}
}
};

View File

@ -51,3 +51,11 @@ pub mod snippets;
pub mod modules;
pub mod anyref_heap_live_count;
pub mod strings;
#[wasm_bindgen_test]
fn closures_work() {
let x = Closure::wrap(Box::new(|| {}) as Box<FnMut()>);
drop(x);
let x = Closure::wrap(Box::new(|| {}) as Box<FnMut()>);
x.forget();
}