Skip to content

Commit

Permalink
updated support for double definition, cf jshint#883
Browse files Browse the repository at this point in the history
  • Loading branch information
guyzmo authored and jugglinmike committed Oct 21, 2014
1 parent 3c6676b commit a9bb1a2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/stable/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,14 @@ var JSHINT = (function () {
}
}
}
// a double definition of a let variable throws a TypeError
if (state.option.esnext && funct["(blockscope)"].getlabelblock(t)) {
error("E044", state.tokens.next, t);
if (state.option.esnext) {
// a double definition of a let variable in same block throws a TypeError
if (_.has(funct["(curblock)"], t)) {
error("E044", state.tokens.next, t);
} else if (!state.option.shadow) {
if (funct["(blockscope)"].getlabelblock(t) || _.has(funct, t))
warning("W004", state.tokens.next, t);
}
}

// if the identifier is from a let, adds it only to the current blockscope
Expand Down

0 comments on commit a9bb1a2

Please sign in to comment.