Skip to content

Commit

Permalink
Merge pull request #1544 from ibaryshnikov/master
Browse files Browse the repository at this point in the history
expose forget to wasm
  • Loading branch information
alexcrichton committed May 20, 2019
2 parents 4049803 + a68cdc5 commit f23b867
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/cli-support/src/js/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
};
Expand Down
8 changes: 8 additions & 0 deletions tests/headless/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit f23b867

Please sign in to comment.