phpConcatParts (languages/php.ts): the parts of a `.` concatenation, left to right — `__DIR__ . '/inc/' . 'a.php'` is a left-nested tree of binary expressions — or None when a link of its left spine lacks a side or isn't a `.`. Walked iteratively.
(expr: Node<'a>, src: &str)
| 1668 | /// expressions — or None when a link of its left spine lacks a side or |
| 1669 | /// isn't a `.`. Walked iteratively. |
| 1670 | fn php_concat_parts<'a>(expr: Node<'a>, src: &str) -> Option<Vec<Node<'a>>> { |
| 1671 | let mut parts: Vec<Node<'a>> = Vec::new(); |
| 1672 | let mut cur = expr; |
| 1673 | loop { |
| 1674 | let left = cur.child_by_field_name("left")?; |
| 1675 | let right = cur.child_by_field_name("right")?; |
| 1676 | if cur.child_by_field_name("operator").is_some_and(|op| &src[op.byte_range()] != ".") { |
| 1677 | return None; |
| 1678 | } |
| 1679 | parts.push(right); |
| 1680 | if left.kind() != "binary_expression" { |
| 1681 | parts.push(left); |
| 1682 | break; |
| 1683 | } |
| 1684 | cur = left; |
| 1685 | } |
| 1686 | parts.reverse(); |
| 1687 | Some(parts) |
| 1688 | } |
| 1689 | |
| 1690 | /// One `namespace_use_declaration`'s part of phpShadowsDirname (#3298): its |
| 1691 | /// text with JS whitespace runs collapsed to one space, the space beside |
no test coverage detected