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

Method resolve_body

codegraph-kernel/src/kotlin.rs:386–401  ·  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

384 /// (fun-interface parent body — unreachable post-defer, kept for
385 /// contract), else first function_body | class_body | enum_class_body.
386 fn resolve_body(&self, node: Node<'t>) -> Option<Node<'t>> {
387 for i in 0..node.named_child_count() {
388 let Some(child) = node.named_child(i) else { continue };
389 if child.kind() == "ERROR" {
390 if let Some(first) = child.child(0) {
391 if first.kind() == "{" {
392 return Some(child);
393 }
394 }
395 }
396 if matches!(child.kind(), "function_body" | "class_body" | "enum_class_body") {
397 return Some(child);
398 }
399 }
400 None
401 }
402
403 // --- createNode ------------------------------------------------------------
404

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