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

Method resolve_body

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

441 /// (fun-interface parent body — unreachable post-defer, kept for
442 /// contract), else first function_body | class_body | enum_class_body.
443 fn resolve_body(&self, node: Node<'t>) -> Option<Node<'t>> {
444 for child in node.named_children(&mut node.walk()) {
445 if child.kind() == "ERROR" {
446 if let Some(first) = child.child(0) {
447 if first.kind() == "{" {
448 return Some(child);
449 }
450 }
451 }
452 if matches!(child.kind(), "function_body" | "class_body" | "enum_class_body") {
453 return Some(child);
454 }
455 }
456 None
457 }
458
459 // --- createNode ------------------------------------------------------------
460

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 1

walkMethod · 0.45

Tested by

no test coverage detected