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

Method extract_static_member_ref

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

1133 /// extractStaticMemberRef — csharp ∈ STATIC_MEMBER_LANGS; C#'s
1134 /// member-access node with the `expression` receiver field.
1135 fn extract_static_member_ref(&mut self, node: Node<'t>) {
1136 if node.kind() != "member_access_expression" {
1137 return;
1138 }
1139 if self.stack.is_empty() {
1140 return;
1141 }
1142 let owner = self.top_row();
1143 // Skip `Type.Method()` — the access is a call's callee, already linked.
1144 if let Some(parent) = node.parent() {
1145 if parent.kind() == "invocation_expression" {
1146 let callee = parent
1147 .child_by_field_name("function")
1148 .or_else(|| parent.child_by_field_name("method"))
1149 .or_else(|| parent.named_child(0));
1150 if let Some(callee) = callee {
1151 if callee.start_byte() == node.start_byte() {
1152 return;
1153 }
1154 }
1155 }
1156 }
1157 let recv = node
1158 .child_by_field_name("object")
1159 .or_else(|| node.child_by_field_name("expression"))
1160 .or_else(|| node.child_by_field_name("scope"))
1161 .or_else(|| node.named_child(0));
1162 let Some(recv) = recv else { return };
1163 if matches!(
1164 recv.kind(),
1165 "identifier" | "type_identifier" | "simple_identifier" | "name" | "scoped_type_identifier"
1166 ) {
1167 let text = self.text(recv);
1168 if capitalized_re().is_match(text) {
1169 self.push_ref_at(owner, &text.to_string(), edge_kind_index("references").unwrap(), recv);
1170 }
1171 }
1172 }
1173
1174 /// extractInheritance — the C# base_list branch (5577): EVERY namedChild
1175 /// 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