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

Method extract_variable

codegraph-kernel/src/swift.rs:957–972  ·  view source on GitHub ↗

extractVariable — the swift top-level branch (:2851): let → constant / var → variable via swiftPropertyInfo; computed skipped; position = the whole declaration; extras = docstring + isExported literal FALSE.

(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

955 /// var → variable via swiftPropertyInfo; computed skipped; position = the
956 /// whole declaration; extras = docstring + isExported literal FALSE.
957 fn extract_variable(&mut self, node: Node<'t>) {
958 let docstring = preceding_docstring(node, self.src);
959 let info = self.swift_property_info(node);
960 let Some(name_node) = info.name_node else { return };
961 if info.is_computed {
962 return;
963 }
964 let kind: &'static str = if info.is_let { "constant" } else { "variable" };
965 let name = self.text(name_node).to_string();
966 self.create_node(
967 kind,
968 &name,
969 node,
970 Extra { docstring, is_exported: Some(false), ..Extra::default() },
971 );
972 }
973
974 fn extract_import(&mut self, node: Node<'t>) {
975 let import_text = self.text(node).trim().to_string();

Callers 1

visit_nodeMethod · 0.45

Calls 4

preceding_docstringFunction · 0.85
swift_property_infoMethod · 0.80
textMethod · 0.65
create_nodeMethod · 0.45

Tested by

no test coverage detected