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

Method extract_static_member_ref

codegraph-kernel/src/swift.rs:1084–1121  ·  view source on GitHub ↗

extractStaticMemberRef — swift's navigation_expression value reads, body walker + walkAttrArgs only.

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

Source from the content-addressed store, hash-verified

1082 /// extractStaticMemberRef — swift's navigation_expression value reads,
1083 /// body walker + walkAttrArgs only.
1084 fn extract_static_member_ref(&mut self, node: Node<'t>) {
1085 if node.kind() != "navigation_expression" {
1086 return;
1087 }
1088 if self.stack.is_empty() {
1089 return;
1090 }
1091 let owner = self.top_row();
1092 // Skip the callee nav of a call.
1093 if let Some(parent) = node.parent() {
1094 if parent.kind() == "call_expression" {
1095 let callee = parent
1096 .child_by_field_name("function")
1097 .or_else(|| parent.child_by_field_name("method"))
1098 .or_else(|| parent.named_child(0));
1099 if let Some(callee) = callee {
1100 if callee.start_byte() == node.start_byte() {
1101 return;
1102 }
1103 }
1104 }
1105 }
1106 let recv = node
1107 .child_by_field_name("object")
1108 .or_else(|| node.child_by_field_name("expression"))
1109 .or_else(|| node.child_by_field_name("scope"))
1110 .or_else(|| node.named_child(0));
1111 let Some(recv) = recv else { return };
1112 if matches!(
1113 recv.kind(),
1114 "identifier" | "type_identifier" | "simple_identifier" | "name" | "scoped_type_identifier"
1115 ) {
1116 let text = self.text(recv);
1117 if capitalized_re().is_match(text) {
1118 self.push_ref_at(owner, &text.to_string(), edge_kind_index("references").unwrap(), recv);
1119 }
1120 }
1121 }
1122
1123 /// extractInheritance — the swift inheritance_specifier case: FIRST
1124 /// type_identifier of each specifier's user_type, everything as `extends`

Callers 2

walk_attr_argsMethod · 0.45

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