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

Method extract_static_member_ref

codegraph-kernel/src/csharp.rs:1245–1282  ·  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

1243 /// extractStaticMemberRef — csharp ∈ STATIC_MEMBER_LANGS; C#'s
1244 /// member-access node with the `expression` receiver field.
1245 fn extract_static_member_ref(&mut self, node: Node<'t>) {
1246 if node.kind() != "member_access_expression" {
1247 return;
1248 }
1249 if self.stack.is_empty() {
1250 return;
1251 }
1252 let owner = self.top_row();
1253 // Skip `Type.Method()` — the access is a call's callee, already linked.
1254 if let Some(parent) = node.parent() {
1255 if parent.kind() == "invocation_expression" {
1256 let callee = parent
1257 .child_by_field_name("function")
1258 .or_else(|| parent.child_by_field_name("method"))
1259 .or_else(|| parent.named_child(0));
1260 if let Some(callee) = callee {
1261 if callee.start_byte() == node.start_byte() {
1262 return;
1263 }
1264 }
1265 }
1266 }
1267 let recv = node
1268 .child_by_field_name("object")
1269 .or_else(|| node.child_by_field_name("expression"))
1270 .or_else(|| node.child_by_field_name("scope"))
1271 .or_else(|| node.named_child(0));
1272 let Some(recv) = recv else { return };
1273 if matches!(
1274 recv.kind(),
1275 "identifier" | "type_identifier" | "simple_identifier" | "name" | "scoped_type_identifier"
1276 ) {
1277 let text = self.text(recv);
1278 if capitalized_re().is_match(text) {
1279 self.push_ref_at(owner, &text.to_string(), edge_kind_index("references").unwrap(), recv);
1280 }
1281 }
1282 }
1283
1284 /// extractInheritance — the C# base_list branch (5577): EVERY namedChild
1285 /// 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