( node: t.Node, ancestors: t.TraversalAncestors, state: ArrayUnpackVisitorState, )
| 58 | |
| 59 | // NOTE: This visitor is meant to be used via t.traverse |
| 60 | const arrayUnpackVisitor = ( |
| 61 | node: t.Node, |
| 62 | ancestors: t.TraversalAncestors, |
| 63 | state: ArrayUnpackVisitorState, |
| 64 | ) => { |
| 65 | if (!ancestors.length) { |
| 66 | // Top-level node: this is the array literal. |
| 67 | return; |
| 68 | } |
| 69 | |
| 70 | if ( |
| 71 | t.isIdentifier(node) && |
| 72 | t.isReferenced(node, ancestors[ancestors.length - 1].node) && |
| 73 | state.bindings[node.name] |
| 74 | ) { |
| 75 | state.deopt = true; |
| 76 | // eslint-disable-next-line @typescript-eslint/only-throw-error |
| 77 | throw STOP_TRAVERSAL; |
| 78 | } |
| 79 | }; |
| 80 | |
| 81 | export type DestructuringTransformerNode = |
| 82 | t.VariableDeclaration | t.ExpressionStatement | t.ReturnStatement; |
nothing calls this directly
no test coverage detected