1-based start line of the tightest function/method enclosing the call.
(ref: UnresolvedRef, context: ResolutionContext)
| 1351 | |
| 1352 | /** 1-based start line of the tightest function/method enclosing the call. */ |
| 1353 | function enclosingScopeStartLine(ref: UnresolvedRef, context: ResolutionContext): number { |
| 1354 | let start = 1; |
| 1355 | for (const n of context.getNodesInFile(ref.filePath)) { |
| 1356 | if (n.kind !== 'function' && n.kind !== 'method') continue; |
| 1357 | if (n.language !== ref.language) continue; |
| 1358 | const end = n.endLine ?? n.startLine; |
| 1359 | if (n.startLine <= ref.line && end >= ref.line && n.startLine >= start) { |
| 1360 | start = n.startLine; |
| 1361 | } |
| 1362 | } |
| 1363 | return start; |
| 1364 | } |
| 1365 | |
| 1366 | /** |
| 1367 | * Infer a receiver's type from its local declaration/initializer in the |
no test coverage detected