( binding: Binding, module: SourceModule, seen: Set<Binding> )
| 277 | |
| 278 | // how many levels down what a const holds can be written, which nothing does |
| 279 | private fixedDepthOfBinding( |
| 280 | binding: Binding, |
| 281 | module: SourceModule, |
| 282 | seen: Set<Binding> |
| 283 | ): number | undefined { |
| 284 | if (seen.has(binding) || binding.kind !== "const") return |
| 285 | seen.add(binding) |
| 286 | const init = initOf(binding) |
| 287 | const depth = init ? this.fixedDepthOf(init, module, seen) : undefined |
| 288 | if (!depth) return depth as 0 | undefined |
| 289 | return ( |
| 290 | this.graph.mayWritesOf(binding, module, heldAs(depth)).length || |
| 291 | this.graph.elsewhereOf(module, binding, depth) |
| 292 | ) ? |
| 293 | undefined |
| 294 | : depth |
| 295 | } |
| 296 | |
| 297 | // what an expression's text alone decides, as how many levels down it holds |
| 298 | // what could be written: 0 for a primitive |
no test coverage detected