(node)
| 8 | export default function(ast, logger) { |
| 9 | traverser.replace(ast, { |
| 10 | enter(node) { |
| 11 | const matches = matchAliasedForLoop(node); |
| 12 | |
| 13 | if (matches) { |
| 14 | if (indexUsedInBody(matches)) { |
| 15 | logger.warn(node, 'Index variable used in for-loop body', 'for-of'); |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | if (matches.itemKind === 'var' || matches.indexKind === 'var') { |
| 20 | logger.warn(node, 'Only for-loops with let/const can be transformed (use let transform first)', 'for-of'); |
| 21 | return; |
| 22 | } |
| 23 | |
| 24 | return withComments(node, createForOf(matches)); |
| 25 | } |
| 26 | |
| 27 | if (node.type === 'ForStatement') { |
| 28 | logger.warn(node, 'Unable to transform for loop', 'for-of'); |
| 29 | } |
| 30 | } |
| 31 | }); |
| 32 | } |
| 33 |
nothing calls this directly
no test coverage detected
searching dependent graphs…