Skip to content

Commit

Permalink
Allow string literal dereferencing as first stmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jugglinmike authored and caitp committed Oct 31, 2014
1 parent 53556a7 commit b5dd259
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -1807,6 +1807,8 @@ var JSHINT = (function () {
// string -> ( is not a valid production
warning("W033", state.tokens.next);
}
} else if (p.id === "." || p.id === "[") {
return;
} else if (p.id !== ";") {
warning("W033", p);
}
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4842,5 +4842,12 @@ exports.testStrictDirectiveASI = function (test) {
.addError(1, "Expected an assignment or function call and instead saw an expression.")
.test("'use strict',function fn() {}\nfn();", options);

TestRun(test, 7)
.test("'use strict'.split(' ');", options);

TestRun(test, 8)
.addError(1, "Missing \"use strict\" statement.")
.test("(function() { var x; \"use strict\"; return x; }());", { strict: true, expr: true });

test.done();
};

0 comments on commit b5dd259

Please sign in to comment.