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

Method extract_import

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

Source from the content-addressed store, hash-verified

1188 }
1189
1190 fn extract_import(&mut self, node: Node<'t>) {
1191 // Comment-gluing: the header's extent (and thus the signature) can
1192 // include trailing comment lines — the trimmed FULL text is the
1193 // signature; the ref stays at the header start.
1194 let import_text = self.text(node).trim().to_string();
1195 let identifier = (0..node.named_child_count())
1196 .filter_map(|i| node.named_child(i))
1197 .find(|c| c.kind() == "identifier");
1198 let Some(identifier) = identifier else { return };
1199 let module_name = self.text(identifier).to_string();
1200 if module_name.is_empty() {
1201 return;
1202 }
1203 self.create_node(
1204 "import",
1205 &module_name,
1206 node,
1207 Extra { signature: Some(import_text), ..Extra::default() },
1208 );
1209 let parent = self.top_row();
1210 self.push_ref_at(parent, &module_name.clone(), edge_kind_index("imports").unwrap(), node);
1211 }
1212
1213 /// extractCall — the kotlin paths: navigation member branch (+ the #750
1214 /// re-encode) and the raw-text else (paren-then-lambda / glued-invoke

Callers 1

visit_nodeMethod · 0.45

Calls 6

edge_kind_indexFunction · 0.85
textMethod · 0.65
unwrapMethod · 0.60
create_nodeMethod · 0.45
top_rowMethod · 0.45
push_ref_atMethod · 0.45

Tested by

no test coverage detected