* The import binding of the type a call's receiver is declared with, read the * way resolution reads it for the call (inferLocalReceiverType, memoized per * file, scope and receiver, so a call the matcher just tried costs a lookup): * the binding the type is written through, `LRUCache` of `new LR
(receiver: string, ref: UnresolvedRef, context: ResolutionContext, mappings: ImportMapping[])
| 5019 | * nearly doubled what an edit of `uri.ts` retried. |
| 5020 | */ |
| 5021 | function localTypeBinding(receiver: string, ref: UnresolvedRef, context: ResolutionContext, mappings: ImportMapping[]): ImportMapping | undefined { |
| 5022 | if (mappings.length === 0) return undefined; |
| 5023 | const decl: { raw?: string } = {}; |
| 5024 | const type = inferLocalReceiverType(receiver, ref, context, decl); |
| 5025 | if (!type || !decl.raw) return undefined; |
| 5026 | if (arrayElementType(type) !== undefined && JS_ARRAY_METHODS.has(ref.referenceName.slice(receiver.length + 1))) return undefined; |
| 5027 | const head = decl.raw.split(/[.<[\s]/)[0]; |
| 5028 | return mappings.find((m) => m.localName === head); |
| 5029 | } |
| 5030 | |
| 5031 | /** |
| 5032 | * The declaration a default import of `filePath` written in `language` binds |
no test coverage detected