extractStaticMemberRef — swift's navigation_expression value reads, body walker + walkAttrArgs only.
(&mut self, node: Node<'t>)
| 1150 | /// extractStaticMemberRef — swift's navigation_expression value reads, |
| 1151 | /// body walker + walkAttrArgs only. |
| 1152 | fn extract_static_member_ref(&mut self, node: Node<'t>) { |
| 1153 | if node.kind() != "navigation_expression" { |
| 1154 | return; |
| 1155 | } |
| 1156 | if self.stack.is_empty() { |
| 1157 | return; |
| 1158 | } |
| 1159 | let owner = self.top_row(); |
| 1160 | // Skip the callee nav of a call. |
| 1161 | if let Some(parent) = node.parent() { |
| 1162 | if parent.kind() == "call_expression" { |
| 1163 | let callee = parent |
| 1164 | .child_by_field_name("function") |
| 1165 | .or_else(|| parent.child_by_field_name("method")) |
| 1166 | .or_else(|| parent.named_child(0)); |
| 1167 | if let Some(callee) = callee { |
| 1168 | if callee.start_byte() == node.start_byte() { |
| 1169 | return; |
| 1170 | } |
| 1171 | } |
| 1172 | } |
| 1173 | } |
| 1174 | let recv = node |
| 1175 | .child_by_field_name("object") |
| 1176 | .or_else(|| node.child_by_field_name("expression")) |
| 1177 | .or_else(|| node.child_by_field_name("scope")) |
| 1178 | .or_else(|| node.named_child(0)); |
| 1179 | let Some(recv) = recv else { return }; |
| 1180 | // A prefix operator binds to the head: `!Config.shared.isOn` is |
| 1181 | // `(!Config).shared.isOn` (tree-sitter.ts). |
| 1182 | let recv = peel_call_wrappers(recv, self.src); |
| 1183 | if matches!( |
| 1184 | recv.kind(), |
| 1185 | "identifier" | "type_identifier" | "simple_identifier" | "name" | "scoped_type_identifier" |
| 1186 | ) { |
| 1187 | let text = self.text(recv); |
| 1188 | if capitalized_re().is_match(text) { |
| 1189 | self.push_ref_at(owner, &text.to_string(), edge_kind_index("references").unwrap(), recv); |
| 1190 | } |
| 1191 | } |
| 1192 | } |
| 1193 | |
| 1194 | /// extractInheritance — the swift inheritance_specifier case: FIRST |
| 1195 | /// type_identifier of each specifier's user_type, everything as `extends` |
no test coverage detected