Skip to content

Commit

Permalink
Fixed #1174: Fixed a false positive 'destructuring assignment' warning (
Browse files Browse the repository at this point in the history
closed #1177)

Signed-off-by: Anton Kovalyov <anton@kovalyov.net>
  • Loading branch information
amirlivneh authored and valueof committed Aug 3, 2013
1 parent 303c535 commit 1a3c47f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/stable/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -4075,7 +4075,7 @@ var JSHINT = (function () {
ret.notJson = true;
break;
}
if (_.contains(["}", "]"], pn.value) && pn1.value === "=") {
if (_.contains(["}", "]"], pn.value) && pn1.value === "=" && bracketStack === 0) {
ret.isDestAssign = true;
ret.notJson = true;
break;
Expand Down
12 changes: 12 additions & 0 deletions tests/stable/unit/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,18 @@ exports["test: destructuring assign of empty values as JS legacy"] = function (t
test.done();
};

exports["test: array element assignment inside array"] = function (test) {
var code = [
"var a1 = {};",
"var a2 = [function f() {a1[0] = 1;}];",
];

TestRun(test)
.test(code);

test.done();
};

exports["test: let statement as moz"] = function (test) {
var code = [
"let x = 1;",
Expand Down

0 comments on commit 1a3c47f

Please sign in to comment.