(binding: Binding)
| 623 | const visited = new Set<Binding>() |
| 624 | const ordered: Array<Declaration> = [] |
| 625 | const visit = (binding: Binding): void => { |
| 626 | if (visited.has(binding) || hasProperty(binding, "import")) return |
| 627 | if (visiting.has(binding)) throw new Error(`Cyclic initialization dependency: ${binding.preferredName}`) |
| 628 | const declaration = this.#declarations.get(binding) |
| 629 | if (declaration === undefined) throw new Error(`Missing definition: ${binding.preferredName}`) |
| 630 | visiting.add(binding) |
| 631 | for (const dependency of declaration.dependencies) visit(dependency) |
| 632 | visiting.delete(binding) |
| 633 | visited.add(binding) |
| 634 | ordered.push(declaration) |
| 635 | } |
| 636 | for (const binding of this.#declarations.keys()) visit(binding) |
| 637 | |
| 638 | const names = new Map(this.#bindings) |
no test coverage detected