Support #[wasm_bindgen(setter, js_name = ...)]

Previously we'd require the explicit `js_name` to *also* start with
`set_`, but when explicitly specified it shouldn't be mangled at all!

Closes #584
This commit is contained in:
Alex Crichton
2018-09-21 17:34:41 -07:00
parent 534cceafc8
commit 75f005be23
5 changed files with 20 additions and 8 deletions

View File

@@ -53,8 +53,12 @@ extern {
fn new() -> RenameProperties;
#[wasm_bindgen(getter = a, method)]
fn test(this: &RenameProperties) -> i32;
#[wasm_bindgen(getter, method, js_name = a)]
fn test2(this: &RenameProperties) -> i32;
#[wasm_bindgen(setter = a, method)]
fn another(this: &RenameProperties, a: i32);
#[wasm_bindgen(setter, method, js_name = a)]
fn another2(this: &RenameProperties, a: i32);
/// dox
pub type AssertImportDenyDocsWorks;
@@ -154,6 +158,8 @@ fn rename_setter_getter() {
assert_eq!(a.test(), 1);
a.another(2);
assert_eq!(a.test(), 2);
a.another2(3);
assert_eq!(a.test2(), 3);
}
/// dox