* Find the least ancestor of the input node that is a valid type for extraction and contains the input span.
(node, span)
| 159681 | * Find the least ancestor of the input node that is a valid type for extraction and contains the input span. |
| 159682 | */ |
| 159683 | function getValidParentNodeContainingSpan(node, span) { |
| 159684 | while (node.parent) { |
| 159685 | if (isValidExpressionOrStatement(node) && span.length !== 0 && node.end >= span.start + span.length) { |
| 159686 | return node; |
| 159687 | } |
| 159688 | node = node.parent; |
| 159689 | } |
| 159690 | return undefined; |
| 159691 | } |
| 159692 | /** |
| 159693 | * Finds an ancestor of the input node that is a valid type for extraction, skipping subexpressions. |
| 159694 | */ |
no test coverage detected