(&mut self, node: Node<'t>)
| 1307 | // --- extractInstantiation (:4610, generic tail) ----------------------- |
| 1308 | |
| 1309 | fn extract_instantiation(&mut self, node: Node<'t>) { |
| 1310 | if self.stack.is_empty() { |
| 1311 | return; |
| 1312 | } |
| 1313 | let from_row = self.top_row(); |
| 1314 | let ctor = node |
| 1315 | .child_by_field_name("constructor") |
| 1316 | .or_else(|| node.child_by_field_name("type")) |
| 1317 | .or_else(|| node.child_by_field_name("name")) |
| 1318 | .or_else(|| node.named_child(0)); |
| 1319 | let Some(ctor) = ctor else { return }; |
| 1320 | let mut class_name = self.text(ctor).to_string(); |
| 1321 | if let Some(lt) = class_name.find('<') { |
| 1322 | if lt > 0 { |
| 1323 | class_name.truncate(lt); |
| 1324 | } |
| 1325 | } |
| 1326 | let last_dot = class_name.rfind('.').map(|i| i as i64).unwrap_or(-1); |
| 1327 | let last_colons = class_name.rfind("::").map(|i| (i + 1) as i64).unwrap_or(-1); |
| 1328 | let last = last_dot.max(last_colons); |
| 1329 | if last >= 0 { |
| 1330 | class_name = class_name[(last as usize + 1)..].to_string(); |
| 1331 | class_name = class_name.trim_start_matches([':', '.']).to_string(); |
| 1332 | } |
| 1333 | let class_name = class_name.trim().to_string(); |
| 1334 | if class_name.is_empty() { |
| 1335 | return; |
| 1336 | } |
| 1337 | self.push_ref_at(from_row, &class_name, "instantiates", node); |
| 1338 | } |
| 1339 | |
| 1340 | // --- extractBareCall (dart.ts:305-379) -------------------------------- |
| 1341 |
no test coverage detected