(&mut self, node: Node<'t>)
| 1182 | // --- extractInstantiation (:4610, generic tail) ----------------------- |
| 1183 | |
| 1184 | fn extract_instantiation(&mut self, node: Node<'t>) { |
| 1185 | if self.stack.is_empty() { |
| 1186 | return; |
| 1187 | } |
| 1188 | let from_row = self.top_row(); |
| 1189 | let ctor = node |
| 1190 | .child_by_field_name("constructor") |
| 1191 | .or_else(|| node.child_by_field_name("type")) |
| 1192 | .or_else(|| node.child_by_field_name("name")) |
| 1193 | .or_else(|| node.named_child(0)); |
| 1194 | let Some(ctor) = ctor else { return }; |
| 1195 | let mut class_name = self.text(ctor).to_string(); |
| 1196 | if let Some(lt) = class_name.find('<') { |
| 1197 | if lt > 0 { |
| 1198 | class_name.truncate(lt); |
| 1199 | } |
| 1200 | } |
| 1201 | let last_dot = class_name.rfind('.').map(|i| i as i64).unwrap_or(-1); |
| 1202 | let last_colons = class_name.rfind("::").map(|i| (i + 1) as i64).unwrap_or(-1); |
| 1203 | let last = last_dot.max(last_colons); |
| 1204 | if last >= 0 { |
| 1205 | class_name = class_name[(last as usize + 1)..].to_string(); |
| 1206 | class_name = class_name.trim_start_matches([':', '.']).to_string(); |
| 1207 | } |
| 1208 | let class_name = class_name.trim().to_string(); |
| 1209 | if class_name.is_empty() { |
| 1210 | return; |
| 1211 | } |
| 1212 | self.push_ref_at(from_row, &class_name, "instantiates", node); |
| 1213 | } |
| 1214 | |
| 1215 | // --- extractBareCall (dart.ts:305-379) -------------------------------- |
| 1216 |
no test coverage detected