Skip to content

Commit

Permalink
[[FIX]] Correct location of reported error
Browse files Browse the repository at this point in the history
Token tokens.curr is incorrectly referenced in warning W138.
  • Loading branch information
jshaptic committed Sep 14, 2017
1 parent 0ff6644 commit 1c434a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -2848,7 +2848,7 @@ var JSHINT = (function() {
// a possible code smell.
if (pastDefault) {
if (state.tokens.next.id !== "=") {
error("W138", state.tokens.current);
error("W138", state.tokens.curr);
}
}
if (state.tokens.next.id === "=") {
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,7 @@ exports.testDefaultArguments = function (test) {
.addError(14, 39, "'bar' is not defined.")
.addError(14, 32, "'num3' was used before it was declared, which is illegal for 'param' variables.")
.addError(15, 32, "'num4' was used before it was declared, which is illegal for 'param' variables.")
.addError(18, 45, "Regular parameters should not come after default parameters.")
.addError(18, 41, "Regular parameters should not come after default parameters.")
.addError(27, 10, "'c' is not defined.")
.addError(33, 4, "'d' was used before it was defined.")
.addError(36, 16, "'e' was used before it was declared, which is illegal for 'param' variables.")
Expand All @@ -1521,7 +1521,7 @@ exports.testDefaultArguments = function (test) {
TestRun(test)
.addError(14, 32, "'num3' was used before it was declared, which is illegal for 'param' variables.")
.addError(15, 32, "'num4' was used before it was declared, which is illegal for 'param' variables.")
.addError(18, 45, "Regular parameters should not come after default parameters.")
.addError(18, 41, "Regular parameters should not come after default parameters.")
.addError(36, 16, "'e' was used before it was declared, which is illegal for 'param' variables.")
.test(src, { moz: true });

Expand All @@ -1536,7 +1536,7 @@ exports.testDefaultArguments = function (test) {
.addError(15, 37, "'default parameters' is only available in ES6 (use 'esversion: 6').")
.addError(15, 32, "'num4' was used before it was declared, which is illegal for 'param' variables.")
.addError(18, 37, "'default parameters' is only available in ES6 (use 'esversion: 6').")
.addError(18, 45, "Regular parameters should not come after default parameters.")
.addError(18, 41, "Regular parameters should not come after default parameters.")
.addError(26, 18, "'default parameters' is only available in ES6 (use 'esversion: 6').")
.addError(31, 18, "'default parameters' is only available in ES6 (use 'esversion: 6').")
.addError(33, 6, "'default parameters' is only available in ES6 (use 'esversion: 6').")
Expand Down

0 comments on commit 1c434a3

Please sign in to comment.