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

Method resolve_body

codegraph-kernel/src/kotlin.rs:302–317  ·  view source on GitHub ↗

resolveBody (kotlin.ts:219): first ERROR child whose child(0) is `{` (fun-interface parent body — unreachable post-defer, kept for contract), else first function_body | class_body | enum_class_body.

(&self, node: Node<'t>)

Source from the content-addressed store, hash-verified

300 /// (fun-interface parent body — unreachable post-defer, kept for
301 /// contract), else first function_body | class_body | enum_class_body.
302 fn resolve_body(&self, node: Node<'t>) -> Option<Node<'t>> {
303 for i in 0..node.named_child_count() {
304 let Some(child) = node.named_child(i) else { continue };
305 if child.kind() == "ERROR" {
306 if let Some(first) = child.child(0) {
307 if first.kind() == "{" {
308 return Some(child);
309 }
310 }
311 }
312 if matches!(child.kind(), "function_body" | "class_body" | "enum_class_body") {
313 return Some(child);
314 }
315 }
316 None
317 }
318
319 // --- createNode ------------------------------------------------------------
320

Callers 6

create_nodeMethod · 0.45
extract_functionMethod · 0.45
extract_methodMethod · 0.45
extract_classMethod · 0.45
extract_interfaceMethod · 0.45
extract_enumMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected