(node: node, id: NodeId)
| 474 | } |
| 475 | |
| 476 | export const withId = <node extends BaseNode>(node: node, id: NodeId): node => { |
| 477 | if (node.id === id) return node |
| 478 | if (isNode(nodesById.get(id))) |
| 479 | throwInternalError(`Unexpected attempt to overwrite node id ${id}`) |
| 480 | // have to ignore cache to force creation of new potentially cyclic id |
| 481 | return createNode({ |
| 482 | id, |
| 483 | kind: node.kind, |
| 484 | inner: node.inner, |
| 485 | meta: node.meta, |
| 486 | $: node.$, |
| 487 | ignoreCache: true |
| 488 | }) as never |
| 489 | } |
| 490 | |
| 491 | export const withMeta = <node extends BaseNode>( |
| 492 | node: node, |
no test coverage detected