Permalink
Browse files

[[FIX]] Report error for offending token value

When a "rest" operator is not followed by the identifier, report the
value of the unexpected token (not the "rest" operator itself).
  • Loading branch information...
jugglinmike committed Oct 18, 2016
1 parent 2a31c94 commit 3b06d0100ca39f463f2bea67a13ed296e13e6628
Showing with 13 additions and 11 deletions.
  1. +1 −1 src/jshint.js
  2. +12 −10 tests/unit/parser.js
@@ -1512,7 +1512,7 @@ var JSHINT = (function() {
}

if (!state.tokens.next.identifier) {
warning("E024", state.tokens.curr, "...");
warning("E024", state.tokens.curr, state.tokens.next.id);
return;
}

@@ -7588,7 +7588,9 @@ exports.extraRestOperator = function (test) {
.addError(1, "Unexpected '...'.")
.addError(2, "Unexpected '...'.")
.addError(3, "Unexpected '...'.")
.addError(3, "Unexpected ')'.")
.addError(4, "Unexpected '...'.")
.addError(4, "Unexpected ')'.")
.addError(5, "Unexpected '...'.")
.addError(6, "Unexpected '...'.")
.addError(7, "Unexpected '...'.")
@@ -7624,16 +7626,16 @@ exports.restOperatorWithoutIdentifier = function (test) {
];

TestRun(test)
.addError(1, "Unexpected '...'.")
.addError(2, "Unexpected '...'.")
.addError(3, "Unexpected '...'.")
.addError(4, "Unexpected '...'.")
.addError(5, "Unexpected '...'.")
.addError(6, "Unexpected '...'.")
.addError(7, "Unexpected '...'.")
.addError(8, "Unexpected '...'.")
.addError(9, "Unexpected '...'.")
.addError(10, "Unexpected '...'.")
.addError(1, "Unexpected ']'.")
.addError(2, "Unexpected ']'.")
.addError(3, "Unexpected ')'.")
.addError(4, "Unexpected ')'.")
.addError(5, "Unexpected ']'.")
.addError(6, "Unexpected ']'.")
.addError(7, "Unexpected ')'.")
.addError(8, "Unexpected ')'.")
.addError(9, "Unexpected ']'.")
.addError(10, "Unexpected ']'.")
.test(code, { esnext: true });

test.done();

0 comments on commit 3b06d01

Please sign in to comment.