(ast: A)
| 4367 | |
| 4368 | /** @internal */ |
| 4369 | export function getContextOwner<A extends AST>(ast: A): A { |
| 4370 | const existing = bodyOwners.get(ast) |
| 4371 | if (existing !== undefined) return existing as A |
| 4372 | if (ast.encoding === undefined) return ast |
| 4373 | // A body representative must not expose or retain the node's own codec. |
| 4374 | const owner = copy(ast, { encoding: undefined }) |
| 4375 | bodyOwners.set(ast, owner) |
| 4376 | return owner |
| 4377 | } |
| 4378 | |
| 4379 | /** @internal */ |
| 4380 | export function replaceEncoding<A extends AST>(ast: A, encoding: Encoding | undefined): A { |
no test coverage detected