Skip to content

Commit

Permalink
[[FIX]] Allow optional chaining call as satement
Browse files Browse the repository at this point in the history
Take care to only disable warning W030 for the "function call" form of
the optional chaining feature; the warning is still relevant for
property access.
  • Loading branch information
jugglinmike authored and rwaldron committed Aug 6, 2021
1 parent 7c890aa commit 11dc0a6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 1 addition & 0 deletions src/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -3075,6 +3075,7 @@ var JSHINT = (function() {
that.left = left;
advance();
that.right = state.tokens.curr.led(context, left);
that.exps = true;
} else {
state.syntax["."].led.call(that, context, left);
}
Expand Down
4 changes: 0 additions & 4 deletions tests/unit/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -10547,10 +10547,6 @@ exports.optionalChaining = function (test) {
);

TestRun(test, "arguments")
.addError(1, 10, "Expected an assignment or function call and instead saw an expression.")
.addError(2, 14, "Expected an assignment or function call and instead saw an expression.")
.addError(3, 20, "Expected an assignment or function call and instead saw an expression.")
.addError(4, 15, "Expected an assignment or function call and instead saw an expression.")
.test([
"true.x?.();",
"true.x?.(true);",
Expand Down

0 comments on commit 11dc0a6

Please sign in to comment.