* Walk call expression. * @param {CallExpression} expression expression
(expression)
| 4146 | * @param {CallExpression} expression expression |
| 4147 | */ |
| 4148 | walkCallExpression(expression) { |
| 4149 | if ( |
| 4150 | expression.callee.type === "MemberExpression" && |
| 4151 | isFunctionExpression(expression.callee.object.type) && |
| 4152 | !expression.callee.computed && |
| 4153 | /** @type {boolean} */ |
| 4154 | ( |
| 4155 | /** @type {Identifier} */ |
| 4156 | (expression.callee.property).name === "call" || |
| 4157 | /** @type {Identifier} */ |
| 4158 | (expression.callee.property).name === "bind" |
| 4159 | ) && |
| 4160 | expression.arguments.length > 0 && |
| 4161 | isSimpleFunction( |
| 4162 | /** @type {FunctionExpression | ArrowFunctionExpression} */ |
| 4163 | (expression.callee.object) |
| 4164 | ) |
| 4165 | ) { |
| 4166 | // (function(…) { }.call/bind(?, …)) |
| 4167 | this._walkIIFE( |
| 4168 | /** @type {FunctionExpression | ArrowFunctionExpression} */ |
| 4169 | (expression.callee.object), |
| 4170 | expression.arguments.slice(1), |
| 4171 | expression.arguments[0] |
| 4172 | ); |
| 4173 | } else if ( |
| 4174 | isFunctionExpression(expression.callee.type) && |
| 4175 | isSimpleFunction( |
| 4176 | /** @type {FunctionExpression | ArrowFunctionExpression} */ |
| 4177 | (expression.callee) |
| 4178 | ) |
| 4179 | ) { |
| 4180 | // (function(…) { }(…)) |
| 4181 | this._walkIIFE( |
| 4182 | /** @type {FunctionExpression | ArrowFunctionExpression} */ |
| 4183 | (expression.callee), |
| 4184 | expression.arguments, |
| 4185 | null |
| 4186 | ); |
| 4187 | } else { |
| 4188 | if (expression.callee.type === "MemberExpression") { |
| 4189 | // callMemberChainOfCallMemberChain only applies to call-rooted |
| 4190 | // chains (e.g. `a().b()`); for the common identifier/this-rooted |
| 4191 | // callee the CALL lookup always rejects, so gate on the cheap root. |
| 4192 | if ( |
| 4193 | this.getMemberExpressionRoot(expression.callee).type === |
| 4194 | "CallExpression" |
| 4195 | ) { |
| 4196 | const exprInfo = this.getMemberExpressionInfo( |
| 4197 | expression.callee, |
| 4198 | ALLOWED_MEMBER_TYPES_CALL_EXPRESSION |
| 4199 | ); |
| 4200 | if (exprInfo && exprInfo.type === "call") { |
| 4201 | const result = this.callHooksForInfo( |
| 4202 | this.hooks.callMemberChainOfCallMemberChain, |
| 4203 | exprInfo.rootInfo, |
| 4204 | expression, |
| 4205 | exprInfo.getCalleeMembers(), |
no test coverage detected