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

Method resolve_body

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

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

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