Returns the first `str_lit` child, used for docstrings.
(state: &ExtractionState, node: TsNode<'_>)
| 431 | |
| 432 | /// Returns the first `str_lit` child, used for docstrings. |
| 433 | fn extract_string_child(state: &ExtractionState, node: TsNode<'_>) -> Option<String> { |
| 434 | let mut cursor = node.walk(); |
| 435 | if cursor.goto_first_child() { |
| 436 | loop { |
| 437 | let child = cursor.node(); |
| 438 | if child.kind() == "str_lit" { |
| 439 | let text = state.node_text(child); |
| 440 | return Some(text.trim_matches('"').to_string()); |
| 441 | } |
| 442 | if !cursor.goto_next_sibling() { |
| 443 | break; |
| 444 | } |
| 445 | } |
| 446 | } |
| 447 | None |
| 448 | } |
| 449 | |
| 450 | /// Collects call sites from the body of a defn, skipping the first `skip` children. |
| 451 | /// |