(ast: A)
| 4788 | }) |
| 4789 | |
| 4790 | function stripEncoding<A extends AST>(ast: A): A { |
| 4791 | const cached = types.get(ast) |
| 4792 | if (cached) return cached as A |
| 4793 | const source = flippedFrom.get(ast) |
| 4794 | const wasProjected = source && types.get(source) === source |
| 4795 | const out = source && reversed.get(source) || projectType(ast) |
| 4796 | if (wasProjected) reversed.set(source, out) |
| 4797 | types.set(ast, out) |
| 4798 | // Projected nodes map to themselves, so the cache also identifies completed projections. |
| 4799 | if (out !== ast) types.set(out, out) |
| 4800 | return out as A |
| 4801 | } |
| 4802 | |
| 4803 | function projectOwner<A extends AST>(ast: A, project: (ast: A) => AST): A | undefined { |
| 4804 | const owner = getContextOwner(ast) |
no test coverage detected