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

Method extract_static_member_ref

codegraph-kernel/src/csharp.rs:1266–1303  ·  view source on GitHub ↗

extractStaticMemberRef — csharp ∈ STATIC_MEMBER_LANGS; C#'s member-access node with the `expression` receiver field.

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

Source from the content-addressed store, hash-verified

1264 /// extractStaticMemberRef — csharp ∈ STATIC_MEMBER_LANGS; C#'s
1265 /// member-access node with the `expression` receiver field.
1266 fn extract_static_member_ref(&mut self, node: Node<'t>) {
1267 if node.kind() != "member_access_expression" {
1268 return;
1269 }
1270 if self.stack.is_empty() {
1271 return;
1272 }
1273 let owner = self.top_row();
1274 // Skip `Type.Method()` — the access is a call's callee, already linked.
1275 if let Some(parent) = node.parent() {
1276 if parent.kind() == "invocation_expression" {
1277 let callee = parent
1278 .child_by_field_name("function")
1279 .or_else(|| parent.child_by_field_name("method"))
1280 .or_else(|| parent.named_child(0));
1281 if let Some(callee) = callee {
1282 if callee.start_byte() == node.start_byte() {
1283 return;
1284 }
1285 }
1286 }
1287 }
1288 let recv = node
1289 .child_by_field_name("object")
1290 .or_else(|| node.child_by_field_name("expression"))
1291 .or_else(|| node.child_by_field_name("scope"))
1292 .or_else(|| node.named_child(0));
1293 let Some(recv) = recv else { return };
1294 if matches!(
1295 recv.kind(),
1296 "identifier" | "type_identifier" | "simple_identifier" | "name" | "scoped_type_identifier"
1297 ) {
1298 let text = self.text(recv);
1299 if capitalized_re().is_match(text) {
1300 self.push_ref_at(owner, &text.to_string(), edge_kind_index("references").unwrap(), recv);
1301 }
1302 }
1303 }
1304
1305 /// extractInheritance — the C# base_list branch (5577): EVERY namedChild
1306 /// emits one `extends` ref (interfaces conflated by design; the garbage

Callers 1

Calls 6

edge_kind_indexFunction · 0.85
capitalized_reFunction · 0.70
textMethod · 0.65
unwrapMethod · 0.60
top_rowMethod · 0.45
push_ref_atMethod · 0.45

Tested by

no test coverage detected