| 202 | } |
| 203 | } |
| 204 | class InPlaceCompiler extends TraversalCompiler { |
| 205 | override readonly inPlace = true |
| 206 | |
| 207 | override reach(node: BaseNode): void { |
| 208 | include(node) |
| 209 | } |
| 210 | |
| 211 | override refToId(id: NodeId, opts?: ReferenceOptions): string { |
| 212 | const reference = this.link.byId[id] |
| 213 | const kind = opts?.kind ?? this.trav |
| 214 | if (reference && !kindsByNode.get(reference)?.includes(kind)) |
| 215 | this.link.dependencies[`${this.nameOf(id)}${kind}`] = [reference, kind] |
| 216 | |
| 217 | return super.refToId(id, opts) |
| 218 | } |
| 219 | |
| 220 | override ref(value: object | symbol): string { |
| 221 | if (!isNode(value) || !value.isRoot() || !value.tfs) |
| 222 | return super.ref(value) |
| 223 | include(value) |
| 224 | let shape = shapes.get(value) |
| 225 | if (!shape) shapes.set(value, (shape = Object.create(value) as object)) |
| 226 | return super.ref(shape) |
| 227 | } |
| 228 | } |
| 229 | const link = createLinkage(undefined, { compiler: InPlaceCompiler }) |
| 230 | include(root) |
| 231 | const names: string[][] = [] |
nothing calls this directly
no outgoing calls
no test coverage detected