( kind: NodeKind, impl: UnknownNodeImplementation, inner: dict, metaJson: JsonObject | undefined, $: BaseScope )
| 368 | // a reference bound to a scope keeps its original's id, so a child from |
| 369 | // another scope is keyed by that scope too |
| 370 | const nodeKeyOf = ( |
| 371 | kind: NodeKind, |
| 372 | impl: UnknownNodeImplementation, |
| 373 | inner: dict, |
| 374 | metaJson: JsonObject | undefined, |
| 375 | $: BaseScope |
| 376 | ): string => { |
| 377 | let key: string = kind |
| 378 | for (const k in inner) { |
| 379 | const v = inner[k] |
| 380 | key += `,${k}:${ |
| 381 | impl.keys[k].child === true ? |
| 382 | isArray(v) ? `[${idsOf(v as BaseNode[], $)}]` |
| 383 | : idOf(v as BaseNode, $) |
| 384 | : k === "unit" ? |
| 385 | kind === "unit" ? |
| 386 | literalKeyOf(v) |
| 387 | : `${JSON.stringify((v as BoundUnit).singular)}/${JSON.stringify((v as BoundUnit).plural)}` |
| 388 | : valueKeyOf(v, $) |
| 389 | }` |
| 390 | } |
| 391 | // an alias inlines a reference that has resolved when it's written |
| 392 | if ( |
| 393 | kind === "alias" && |
| 394 | hasArkKind(nodesById.get(inner.reference as string), "root") |
| 395 | ) |
| 396 | key += ",!" |
| 397 | return metaJson ? `${key},${JSON.stringify(metaJson)}` : key |
| 398 | } |
| 399 | |
| 400 | const idsOf = (nodes: readonly BaseNode[], $: BaseScope): string => { |
| 401 | let ids = "" |
no test coverage detected