Skip to content

Commit

Permalink
[[FIX]] Allow destructuring in setter parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo authored and jugglinmike committed Feb 14, 2016
1 parent ea0aeac commit 97d0ac1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -3259,7 +3259,7 @@ var JSHINT = (function() {
// Don't warn about getter/setter pairs if this is an ES6 concise method
if (nextVal === "get" && i && p) {
warning("W076", t, p[0], i);
} else if (nextVal === "set" && i && (!p || p.length !== 1)) {
} else if (nextVal === "set" && i && f["(metrics)"].arity !== 1) {
warning("W077", t, i);
}
} else {
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2071,5 +2071,17 @@ exports["gh-2838"] = function (test) {
.addError(5, "'d' was used before it was declared, which is illegal for 'let' variables.")
.test(code, { esversion: 6 });

test.done();
};

exports["destructuring in setter parameter"] = function (test) {

TestRun(test).test([
"var a = {",
" get x() {},",
" set x({ a, b }) {}",
"};"
], { esversion: 6 });

test.done();
};

0 comments on commit 97d0ac1

Please sign in to comment.