( node: Node, module: SourceModule )
| 6052 | // e.g. `Store` of `class Store {}`, unless the program may change it, or |
| 6053 | // one a package exports where the build reads the whole program |
| 6054 | private instanceClassOf( |
| 6055 | node: Node, |
| 6056 | module: SourceModule |
| 6057 | ): [Class, SourceModule] | undefined { |
| 6058 | node = unwrapChain(node) |
| 6059 | const binding = module.scopes.byId.get(node)?.binding |
| 6060 | if (binding?.kind === "class") { |
| 6061 | return ( |
| 6062 | readsOnlyMembers(binding) && |
| 6063 | !this.writesThrough(binding, module).length |
| 6064 | ) ? |
| 6065 | [binding.declaration as Class, module] |
| 6066 | : undefined |
| 6067 | } |
| 6068 | const definition = this.view && this.definitionOf(node, module) |
| 6069 | return ( |
| 6070 | definition && |
| 6071 | (definition[0].type === "ClassDeclaration" || |
| 6072 | definition[0].type === "ClassExpression") |
| 6073 | ) ? |
| 6074 | (definition as [Class, SourceModule]) |
| 6075 | : undefined |
| 6076 | } |
| 6077 | |
| 6078 | // the function or class a value names, read through a package's modules: |
| 6079 | // e.g. `register` of `import { register } from "registry"`, or |
no test coverage detected