try to fix js_name error when both getter and setter used (#2074)

* try to fix js_name error when both `getter` and `setter` used

* add tests
This commit is contained in:
a1trl9
2020-04-11 00:57:36 +08:00
committed by GitHub
parent 301a5f36eb
commit b9f78aba57
4 changed files with 195 additions and 7 deletions

View File

@ -330,12 +330,6 @@ impl Function {
pub fn infer_setter_property(&self) -> Result<String, Diagnostic> {
let name = self.name.to_string();
// if `#[wasm_bindgen(js_name = "...")]` is used then that explicitly
// because it was hand-written anyway.
if self.renamed_via_js_name {
return Ok(name);
}
// Otherwise we infer names based on the Rust function name.
if !name.starts_with("set_") {
bail_span!(