Check if a node has a specific modifier keyword.
(node: TsNode<'_>, state: &ExtractionState, modifier: &str)
| 958 | |
| 959 | /// Check if a node has a specific modifier keyword. |
| 960 | fn has_modifier(node: TsNode<'_>, state: &ExtractionState, modifier: &str) -> bool { |
| 961 | let mut cursor = node.walk(); |
| 962 | if cursor.goto_first_child() { |
| 963 | loop { |
| 964 | let child = cursor.node(); |
| 965 | if child.kind() == "modifiers" { |
| 966 | let text = state.node_text(child); |
| 967 | return text.split_whitespace().any(|w| w == modifier); |
| 968 | } |
| 969 | if !cursor.goto_next_sibling() { |
| 970 | break; |
| 971 | } |
| 972 | } |
| 973 | } |
| 974 | false |
| 975 | } |
| 976 | |
| 977 | /// Check if a node has a direct child of a given kind. |
| 978 | fn has_child_of_kind(node: TsNode<'_>, kind: &str) -> bool { |