* The links of an assignment target written as plain names — `dw_page` → * `['dw_page']`, `window.App` → `['window', 'App']`, `App.utils.dom` → * `['App', 'utils', 'dom']`, `module.exports` (the module's export object, * #2966) — or null for anything else: `this.x`, a computed `a[k]`, a cal
(left: SyntaxNode | null)
| 3698 | * prototype. |
| 3699 | */ |
| 3700 | private objectOwnerPath(left: SyntaxNode | null): string[] | null { |
| 3701 | const path: string[] = []; |
| 3702 | let cur = left; |
| 3703 | while (cur?.type === 'member_expression') { |
| 3704 | const property = getChildByField(cur, 'property'); |
| 3705 | if (property?.type !== 'property_identifier') return null; |
| 3706 | path.unshift(getNodeText(property, this.source)); |
| 3707 | cur = getChildByField(cur, 'object'); |
| 3708 | } |
| 3709 | if (cur?.type !== 'identifier') return null; |
| 3710 | const root = getNodeText(cur, this.source); |
| 3711 | const exportObject = root === 'module' && path.length === 1 && path[0] === 'exports'; |
| 3712 | if (!exportObject && (root === 'module' || root === 'exports' || path.includes('prototype'))) return null; |
| 3713 | path.unshift(root); |
| 3714 | return path; |
| 3715 | } |
| 3716 | |
| 3717 | /** |
| 3718 | * Extract function-valued properties of an object literal as named function |
no test coverage detected