( pattern: Node, held: Held, module: SourceModule )
| 5672 | |
| 5673 | // e.g. `const { a } = o`, through whose bindings the program may write `o` |
| 5674 | private mayWriteThrough( |
| 5675 | pattern: Node, |
| 5676 | held: Held, |
| 5677 | module: SourceModule |
| 5678 | ): Node | undefined { |
| 5679 | const holdings = patternHoldingsOf(pattern, held) |
| 5680 | if (!holdings) return this.escape(pattern) |
| 5681 | for (const [id, held] of holdings) { |
| 5682 | const binding = module.scopes.bindingsById.get(id) |
| 5683 | if (!binding || held.depth <= held.copied) continue |
| 5684 | // the program's imports of a package's modules aren't linked |
| 5685 | if (binding.exportNames.length && this.isPackageModule(module)) |
| 5686 | return this.escape(id) |
| 5687 | this.holdings?.push({ binding, module, held }) |
| 5688 | const [write] = this.mayWritesOf(binding, module, held) |
| 5689 | if (write) return write |
| 5690 | } |
| 5691 | } |
| 5692 | |
| 5693 | // e.g. `list.forEach(v => { v.a = 1 })`, passing what a receiver holds to a |
| 5694 | // callback, which is unknown unless the build reads it: each parameter |
no test coverage detected