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

Method extract_static_member_ref

codegraph-kernel/src/swift.rs:1072–1109  ·  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

1070 /// extractStaticMemberRef — swift's navigation_expression value reads,
1071 /// body walker + walkAttrArgs only.
1072 fn extract_static_member_ref(&mut self, node: Node<'t>) {
1073 if node.kind() != "navigation_expression" {
1074 return;
1075 }
1076 if self.stack.is_empty() {
1077 return;
1078 }
1079 let owner = self.top_row();
1080 // Skip the callee nav of a call.
1081 if let Some(parent) = node.parent() {
1082 if parent.kind() == "call_expression" {
1083 let callee = parent
1084 .child_by_field_name("function")
1085 .or_else(|| parent.child_by_field_name("method"))
1086 .or_else(|| parent.named_child(0));
1087 if let Some(callee) = callee {
1088 if callee.start_byte() == node.start_byte() {
1089 return;
1090 }
1091 }
1092 }
1093 }
1094 let recv = node
1095 .child_by_field_name("object")
1096 .or_else(|| node.child_by_field_name("expression"))
1097 .or_else(|| node.child_by_field_name("scope"))
1098 .or_else(|| node.named_child(0));
1099 let Some(recv) = recv else { return };
1100 if matches!(
1101 recv.kind(),
1102 "identifier" | "type_identifier" | "simple_identifier" | "name" | "scoped_type_identifier"
1103 ) {
1104 let text = self.text(recv);
1105 if capitalized_re().is_match(text) {
1106 self.push_ref_at(owner, &text.to_string(), edge_kind_index("references").unwrap(), recv);
1107 }
1108 }
1109 }
1110
1111 /// extractInheritance — the swift inheritance_specifier case: FIRST
1112 /// 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
unwrapMethod · 0.60
top_rowMethod · 0.45
textMethod · 0.45
push_ref_atMethod · 0.45

Tested by

no test coverage detected