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

Method extract_static_member_ref

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

1123 /// extractStaticMemberRef — csharp ∈ STATIC_MEMBER_LANGS; C#'s
1124 /// member-access node with the `expression` receiver field.
1125 fn extract_static_member_ref(&mut self, node: Node<'t>) {
1126 if node.kind() != "member_access_expression" {
1127 return;
1128 }
1129 if self.stack.is_empty() {
1130 return;
1131 }
1132 let owner = self.top_row();
1133 // Skip `Type.Method()` — the access is a call's callee, already linked.
1134 if let Some(parent) = node.parent() {
1135 if parent.kind() == "invocation_expression" {
1136 let callee = parent
1137 .child_by_field_name("function")
1138 .or_else(|| parent.child_by_field_name("method"))
1139 .or_else(|| parent.named_child(0));
1140 if let Some(callee) = callee {
1141 if callee.start_byte() == node.start_byte() {
1142 return;
1143 }
1144 }
1145 }
1146 }
1147 let recv = node
1148 .child_by_field_name("object")
1149 .or_else(|| node.child_by_field_name("expression"))
1150 .or_else(|| node.child_by_field_name("scope"))
1151 .or_else(|| node.named_child(0));
1152 let Some(recv) = recv else { return };
1153 if matches!(
1154 recv.kind(),
1155 "identifier" | "type_identifier" | "simple_identifier" | "name" | "scoped_type_identifier"
1156 ) {
1157 let text = self.text(recv);
1158 if capitalized_re().is_match(text) {
1159 self.push_ref_at(owner, &text.to_string(), edge_kind_index("references").unwrap(), recv);
1160 }
1161 }
1162 }
1163
1164 /// extractInheritance — the C# base_list branch (5577): EVERY namedChild
1165 /// emits one `extends` ref (interfaces conflated by design; the garbage

Callers 1

Calls 6

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

Tested by

no test coverage detected