Skip to content

Commit

Permalink
Merge pull request #2037 from jugglinmike/revert-1929
Browse files Browse the repository at this point in the history
Revert "Formal parameter names can be the same as function name. Fixes g...
  • Loading branch information
rwaldron committed Jan 3, 2015
2 parents f46fe40 + a70bbda commit 030a7c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
9 changes: 4 additions & 5 deletions src/jshint.js
Expand Up @@ -447,8 +447,7 @@ var JSHINT = (function () {
}
}
} else {
if (((!state.option.shadow && !opts.param) ||
_.contains([ "inner", "outer" ], state.option.shadow)) &&
if ((!state.option.shadow || _.contains([ "inner", "outer" ], state.option.shadow)) &&
type !== "exception" || funct["(blockscope)"].getlabel(name)) {
warning("W004", state.tokens.next, name);
}
Expand Down Expand Up @@ -2736,7 +2735,7 @@ var JSHINT = (function () {
t = tokens[t];
if (t.id) {
params.push(t.id);
addlabel(t.id, { type: "unused", token: t.token, param: true });
addlabel(t.id, { type: "unused", token: t.token });
}
}
} else if (state.tokens.next.value === "...") {
Expand All @@ -2746,11 +2745,11 @@ var JSHINT = (function () {
advance("...");
ident = identifier(true);
params.push(ident);
addlabel(ident, { type: "unused", token: state.tokens.curr, param: true });
addlabel(ident, { type: "unused", token: state.tokens.curr });
} else {
ident = identifier(true);
params.push(ident);
addlabel(ident, { type: "unused", token: state.tokens.curr, param: true });
addlabel(ident, { type: "unused", token: state.tokens.curr });
}

// it is a syntax error to have a regular argument after a default argument
Expand Down
14 changes: 0 additions & 14 deletions tests/unit/parser.js
Expand Up @@ -5136,17 +5136,3 @@ exports.testStrictDirectiveASI = function (test) {

test.done();
};

exports.testGH1928 = function (test) {
var code = [
"var foo = {",
" bar(bar) {",
" return bar;",
" }",
"};"
];

TestRun(test).test(code, { esnext: true });

test.done();
};

0 comments on commit 030a7c4

Please sign in to comment.