File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3081,6 +3081,21 @@ var JSHINT = (function() {
30813081 return that ;
30823082 } , 160 , true ) ;
30833083
3084+
3085+ /**
3086+ * Determine if a CallExpression's "base" is a type of expression commonly
3087+ * used in this position.
3088+ *
3089+ * @param {token } token - token describing the "base" of the CallExpression
3090+ * @returns {boolean }
3091+ */
3092+ function isTypicalCallExpression ( token ) {
3093+ return token . identifier || token . id === "." || token . id === "[" ||
3094+ token . id === "=>" || token . id === "(" || token . id === "&&" ||
3095+ token . id === "||" || token . id === "?" || token . id === "async" ||
3096+ token . id === "?." || ( state . inES6 ( ) && token [ "(name)" ] ) ;
3097+ }
3098+
30843099 infix ( "(" , function ( context , left , that ) {
30853100 if ( state . option . immed && left && ! left . immed && left . id === "function" ) {
30863101 warning ( "W062" ) ;
@@ -3171,9 +3186,7 @@ var JSHINT = (function() {
31713186 addEvalCode ( left , p [ 0 ] ) ;
31723187 }
31733188 }
3174- if ( ! left . identifier && left . id !== "." && left . id !== "[" && left . id !== "=>" &&
3175- left . id !== "(" && left . id !== "&&" && left . id !== "||" && left . id !== "?" &&
3176- left . id !== "async" && ! ( state . inES6 ( ) && left [ "(name)" ] ) ) {
3189+ if ( ! isTypicalCallExpression ( left ) ) {
31773190 warning ( "W067" , that ) ;
31783191 }
31793192 }
Original file line number Diff line number Diff line change @@ -10590,5 +10590,11 @@ exports.optionalChaining = function (test) {
1059010590 { esversion : 11 }
1059110591 ) ;
1059210592
10593+ TestRun ( test , "CallExpression" )
10594+ . test (
10595+ "true?.false();" ,
10596+ { esversion : 11 }
10597+ ) ;
10598+
1059310599 test . done ( ) ;
1059410600} ;
You can’t perform that action at this time.
0 commit comments