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

Method extract_import

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

Source from the content-addressed store, hash-verified

1043 }
1044
1045 fn extract_import(&mut self, node: Node<'t>) {
1046 let import_text = self.text(node).trim().to_string();
1047 let identifier = (0..node.named_child_count())
1048 .filter_map(|i| node.named_child(i))
1049 .find(|c| c.kind() == "identifier");
1050 let Some(identifier) = identifier else { return }; // hook null → nothing
1051 let module_name = self.text(identifier).to_string();
1052 if module_name.is_empty() {
1053 return;
1054 }
1055 self.create_node(
1056 "import",
1057 &module_name,
1058 node,
1059 Extra { signature: Some(import_text), ..Extra::default() },
1060 );
1061 let parent = self.top_row();
1062 self.push_ref_at(parent, &module_name.clone(), edge_kind_index("imports").unwrap(), node);
1063 }
1064
1065 /// extractCall — swift rides the generic member branch (navigation) and
1066 /// the raw-text else; the full matrix is in the checklist.

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