extractStaticMemberRef — swift's navigation_expression value reads, body walker + walkAttrArgs only.
(&mut self, node: Node<'t>)
| 1175 | /// extractStaticMemberRef — swift's navigation_expression value reads, |
| 1176 | /// body walker + walkAttrArgs only. |
| 1177 | fn extract_static_member_ref(&mut self, node: Node<'t>) { |
| 1178 | if node.kind() != "navigation_expression" { |
| 1179 | return; |
| 1180 | } |
| 1181 | if self.stack.is_empty() { |
| 1182 | return; |
| 1183 | } |
| 1184 | let owner = self.top_row(); |
| 1185 | // Skip the callee nav of a call. |
| 1186 | if let Some(parent) = node.parent() { |
| 1187 | if parent.kind() == "call_expression" { |
| 1188 | let callee = parent |
| 1189 | .child_by_field_name("function") |
| 1190 | .or_else(|| parent.child_by_field_name("method")) |
| 1191 | .or_else(|| parent.named_child(0)); |
| 1192 | if let Some(callee) = callee { |
| 1193 | if callee.start_byte() == node.start_byte() { |
| 1194 | return; |
| 1195 | } |
| 1196 | } |
| 1197 | } |
| 1198 | } |
| 1199 | let recv = node |
| 1200 | .child_by_field_name("object") |
| 1201 | .or_else(|| node.child_by_field_name("expression")) |
| 1202 | .or_else(|| node.child_by_field_name("scope")) |
| 1203 | .or_else(|| node.named_child(0)); |
| 1204 | let Some(recv) = recv else { return }; |
| 1205 | // A prefix operator binds to the head: `!Config.shared.isOn` is |
| 1206 | // `(!Config).shared.isOn` (tree-sitter.ts). |
| 1207 | let recv = peel_call_wrappers(recv, self.src); |
| 1208 | if matches!( |
| 1209 | recv.kind(), |
| 1210 | "identifier" | "type_identifier" | "simple_identifier" | "name" | "scoped_type_identifier" |
| 1211 | ) { |
| 1212 | let text = self.text(recv); |
| 1213 | if capitalized_re().is_match(text) { |
| 1214 | self.push_ref_at(owner, &text.to_string(), edge_kind_index("references").unwrap(), recv); |
| 1215 | } |
| 1216 | } |
| 1217 | } |
| 1218 | |
| 1219 | /// extractInheritance — the swift inheritance_specifier case: FIRST |
| 1220 | /// type_identifier of each specifier's user_type, everything as `extends` |
no test coverage detected