(ast: A, context: Context | undefined)
| 3352 | |
| 3353 | /** @internal */ |
| 3354 | export function replaceContext<A extends AST>(ast: A, context: Context | undefined): A { |
| 3355 | if (ast.context === context) { |
| 3356 | return ast |
| 3357 | } |
| 3358 | const owner = getContextOwner(ast) |
| 3359 | if (owner.context === context) { |
| 3360 | return owner as A |
| 3361 | } |
| 3362 | const out = modifyOwnPropertyDescriptors(ast, (d) => { |
| 3363 | d.context.value = context |
| 3364 | }) |
| 3365 | contextOwners.set(out, owner) |
| 3366 | return out |
| 3367 | } |
| 3368 | |
| 3369 | /** @internal */ |
| 3370 | export function getLastEncoding(ast: AST): AST { |
no test coverage detected