extractInstantiation — struct_expression via the GENERIC path: strip from the first `<`, keep the trailing `::`/`.` segment (JS slice semantics: slice(lastDot+1) after a `::` leaves one `:`, then ONE leading `[:.]` is stripped).
(&mut self, node: Node<'t>)
| 1007 | /// semantics: slice(lastDot+1) after a `::` leaves one `:`, then ONE |
| 1008 | /// leading `[:.]` is stripped). |
| 1009 | fn extract_instantiation(&mut self, node: Node<'t>) { |
| 1010 | if self.stack.is_empty() { |
| 1011 | return; |
| 1012 | } |
| 1013 | let ctor = node |
| 1014 | .child_by_field_name("constructor") |
| 1015 | .or_else(|| node.child_by_field_name("type")) |
| 1016 | .or_else(|| node.child_by_field_name("name")) |
| 1017 | .or_else(|| node.named_child(0)); |
| 1018 | let Some(ctor) = ctor else { return }; |
| 1019 | |
| 1020 | let mut class_name = self.text(ctor).to_string(); |
| 1021 | if let Some(lt) = class_name.find('<') { |
| 1022 | if lt > 0 { |
| 1023 | class_name.truncate(lt); |
| 1024 | } |
| 1025 | } |
| 1026 | let last_dot = class_name.rfind('.').map(|i| i as i64).unwrap_or(-1); |
| 1027 | let last_colon = class_name.rfind("::").map(|i| i as i64).unwrap_or(-1); |
| 1028 | let last = last_dot.max(last_colon); |
| 1029 | if last >= 0 { |
| 1030 | class_name = class_name[(last + 1) as usize..].to_string(); |
| 1031 | if let Some(rest) = class_name.strip_prefix(&[':', '.'][..]) { |
| 1032 | class_name = rest.to_string(); |
| 1033 | } |
| 1034 | } |
| 1035 | let class_name = class_name.trim().to_string(); |
| 1036 | |
| 1037 | if !class_name.is_empty() { |
| 1038 | let from = self.top_row(); |
| 1039 | self.push_ref_at(from, &class_name, edge_kind_index("instantiates").unwrap(), node); |
| 1040 | } |
| 1041 | } |
| 1042 | |
| 1043 | /// extractRustMacroCalls (#3251): the calls and variant paths in the |
| 1044 | /// arguments of an expression macro (`format!`, `assert_eq!`, `vec!`, |
no test coverage detected