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

Method extract_class

codegraph-kernel/src/kotlin.rs:1112–1141  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

1110 }
1111
1112 fn extract_class(&mut self, node: Node<'t>) {
1113 stack_guard!();
1114 let resolved_body = self.resolve_body(node);
1115 let name = self.extract_name(node);
1116 let extra = Extra {
1117 docstring: preceding_docstring(node, self.src),
1118 visibility: Some(self.visibility_of(node)),
1119 ..Extra::default()
1120 };
1121 let Some(row) = self.create_node("class", &name, node, extra) else { return };
1122 self.extract_inheritance(node, row);
1123 // primaryCtor refs: csharp-gated no-op.
1124 self.extract_decorators_for(node, row);
1125 self.stack.push(Scope { row, kind: "class", name });
1126 // Bodied: the header's code (ctor defaults, super-ctor args, a `by`
1127 // delegate — class_header_code) is walked first, then the class_body
1128 // children (primary-ctor properties still mint nothing). Bodiless: the
1129 // class node itself → every header child visited → the same calls
1130 // attribute to the CLASS.
1131 if resolved_body.is_some() {
1132 for code in class_header_code(node) {
1133 self.visit_node(code);
1134 }
1135 }
1136 let body = resolved_body.unwrap_or(node);
1137 for c in body.named_children(&mut body.walk()) {
1138 self.visit_node(c);
1139 }
1140 self.stack.pop();
1141 }
1142
1143 fn extract_interface(&mut self, node: Node<'t>) {
1144 stack_guard!();

Callers 2

visit_nodeMethod · 0.45

Calls 11

preceding_docstringFunction · 0.85
class_header_codeFunction · 0.85
pushMethod · 0.80
resolve_bodyMethod · 0.45
extract_nameMethod · 0.45
visibility_ofMethod · 0.45
create_nodeMethod · 0.45
extract_inheritanceMethod · 0.45
visit_nodeMethod · 0.45
walkMethod · 0.45

Tested by

no test coverage detected