MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / last_simple_identifier

Function last_simple_identifier

codegraph-kernel/src/swift.rs:266–278  ·  view source on GitHub ↗

lastNamedOfType (function-ref.ts:600): rightmost matching DESCENDANT in document order (deeper matches override).

(node: Node<'t>)

Source from the content-addressed store, hash-verified

264/// lastNamedOfType (function-ref.ts:600): rightmost matching DESCENDANT in
265/// document order (deeper matches override).
266fn last_simple_identifier<'t>(node: Node<'t>) -> Option<Node<'t>> {
267 let mut found: Option<Node<'t>> = None;
268 for i in 0..node.named_child_count() {
269 let Some(child) = node.named_child(i) else { continue };
270 if child.kind() == "simple_identifier" {
271 found = Some(child);
272 }
273 if let Some(deeper) = last_simple_identifier(child) {
274 found = Some(deeper);
275 }
276 }
277 found
278}
279
280impl<'t> Walker<'t> {
281 fn text(&self, node: Node) -> &'t str {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected