* Performs a true post-order traversal of the AST (children before parent). * This traversal strategy is essential for this transformation. By processing the innermost * `html` templates first, we ensure that a nested template is already converted into an * `ObjectExpression` before its parent te
(node, visitor)
| 99 | * @private |
| 100 | */ |
| 101 | function postOrderWalk(node, visitor) { |
| 102 | if (!node) return; |
| 103 | |
| 104 | Object.entries(node).forEach(([key, value]) => { |
| 105 | if (key === 'parent') return; |
| 106 | if (Array.isArray(value)) { |
| 107 | value.forEach(child => postOrderWalk(child, visitor)); |
| 108 | } else if (typeof value === 'object' && value !== null) { |
| 109 | postOrderWalk(value, visitor); |
| 110 | } |
| 111 | }); |
| 112 | |
| 113 | visitor(node); |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * Recursively adds parent pointers to each node in the AST. |
no test coverage detected