A factory for collision-free synthetic def names within a known name set.
(existing)
| 79 | |
| 80 | /** A factory for collision-free synthetic def names within a known name set. */ |
| 81 | function nameAllocator(existing) { |
| 82 | const taken = new Set(existing) |
| 83 | return (candidate) => { |
| 84 | let name = candidate |
| 85 | let n = 2 |
| 86 | while (taken.has(name)) name = `${candidate}${n++}` |
| 87 | taken.add(name) |
| 88 | return name |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | /** The vendor provenance a def synthesized out of `owner` inherits (none for a spec owner). */ |
| 93 | function inheritedVendor(owner) { |
no test coverage detected