Add a #[wasm_bindgen(constructor)] attribute

This can be used for specifying that a static function should actually delegate
to `new`
This commit is contained in:
Alex Crichton
2018-02-06 15:19:47 -08:00
parent e60aa6a990
commit ec5f0a29f7
6 changed files with 131 additions and 24 deletions

View File

@ -367,7 +367,7 @@ fn bindgen_imported_struct(import: &ast::ImportStruct, tokens: &mut Tokens) {
let mut methods = Tokens::new();
for &(_is_method, ref f) in import.functions.iter() {
for &(_, ref f) in import.functions.iter() {
let import_name = shared::mangled_import_name(
Some(&import.name.to_string()),
f.wasm_function.name.as_ref(),