( fn: Node, module: SourceModule, ctx: ThisReadsContext )
| 1804 | } |
| 1805 | |
| 1806 | const computeSkippedFunction = ( |
| 1807 | fn: Node, |
| 1808 | module: SourceModule, |
| 1809 | ctx: ThisReadsContext |
| 1810 | ): boolean => { |
| 1811 | const classMember = classMemberParentOf(fn) |
| 1812 | if (classMember) { |
| 1813 | // class-field function expressions are own enumerable properties and can be |
| 1814 | // detached by spread, Object.assign, or property reads — always index them |
| 1815 | if (classMember.type !== "MethodDefinition") return false |
| 1816 | // ES6 class constructors throw without `new` and cannot bind an object literal |
| 1817 | if (classMember.kind === "constructor") return true |
| 1818 | const key = classMemberKeyOf(classMember, module) |
| 1819 | if (key === undefined) return false |
| 1820 | if (ctx.hasProtoInheritance || ctx.hasDescriptorRead) return false |
| 1821 | if (classMember.kind === "method" && ctx.uncalledKeys.has(key)) return false |
| 1822 | const cls = classMember.parent?.parent |
| 1823 | if ( |
| 1824 | !cls || |
| 1825 | (cls.type !== "ClassDeclaration" && cls.type !== "ClassExpression") |
| 1826 | ) |
| 1827 | return false |
| 1828 | return !classExposesMembers(cls, module, ctx) |
| 1829 | } |
| 1830 | const es5Method = es5ProtoMethodOf(fn, module) |
| 1831 | if (es5Method) { |
| 1832 | if (ctx.hasProtoInheritance || ctx.hasDescriptorRead) return false |
| 1833 | if (ctx.uncalledKeys.has(es5Method.methodKey)) return false |
| 1834 | return !ctorExposesPrototype(es5Method.ctorBinding, module, ctx) |
| 1835 | } |
| 1836 | return isDeadTopLevelFunction(fn, module, ctx) |
| 1837 | } |
| 1838 | |
| 1839 | const instanceExposesComputed = ( |
| 1840 | newExpr: Node, |
no test coverage detected