( file: ts.SourceFile, start: number, end: number )
| 465 | } |
| 466 | |
| 467 | const findCallExpressionInRange = ( |
| 468 | file: ts.SourceFile, |
| 469 | start: number, |
| 470 | end: number |
| 471 | ): ts.CallExpression | undefined => { |
| 472 | const boundingCall = nearestBoundingCallExpression(file, start) |
| 473 | if (boundingCall && boundingCall.pos >= start && boundingCall.end <= end) |
| 474 | return boundingCall |
| 475 | |
| 476 | const allNodes = getDescendants(file) |
| 477 | const nodesInRange = allNodes.filter( |
| 478 | node => node.pos >= start && node.end <= end |
| 479 | ) |
| 480 | |
| 481 | const callExpressions = nodesInRange.filter(node => |
| 482 | syntax.isCallExpression(node) |
| 483 | ) as ts.CallExpression[] |
| 484 | |
| 485 | if (callExpressions.length === 0) return undefined |
| 486 | |
| 487 | const methodCalls = callExpressions.filter(call => |
| 488 | syntax.isPropertyAccessExpression(call.expression) |
| 489 | ) |
| 490 | return methodCalls.length > 0 ? methodCalls[0] : callExpressions[0] |
| 491 | } |
| 492 | |
| 493 | const extractFunctionName = (callExpr: ts.CallExpression): string => { |
| 494 | if (syntax.isPropertyAccessExpression(callExpr.expression)) |
no test coverage detected