* 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[])
| 4797 | * nearly doubled what an edit of `uri.ts` retried. |
| 4798 | */ |
| 4799 | function localTypeBinding(receiver: string, ref: UnresolvedRef, context: ResolutionContext, mappings: ImportMapping[]): ImportMapping | undefined { |
| 4800 | if (mappings.length === 0) return undefined; |
| 4801 | const decl: { raw?: string } = {}; |
| 4802 | const type = inferLocalReceiverType(receiver, ref, context, decl); |
| 4803 | if (!type || !decl.raw) return undefined; |
| 4804 | if (arrayElementType(type) !== undefined && JS_ARRAY_METHODS.has(ref.referenceName.slice(receiver.length + 1))) return undefined; |
| 4805 | const head = decl.raw.split(/[.<[\s]/)[0]; |
| 4806 | return mappings.find((m) => m.localName === head); |
| 4807 | } |
| 4808 | |
| 4809 | /** |
| 4810 | * The declaration a default import of `filePath` written in `language` binds |
no test coverage detected