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

Method extract_static_member_ref

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

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