(&self, node: Node<'t>)
| 1340 | // --- extractBareCall (dart.ts:305-379) -------------------------------- |
| 1341 | |
| 1342 | fn bare_call_name(&self, node: Node<'t>) -> Option<String> { |
| 1343 | if node.kind() == "selector" { |
| 1344 | let mut cursor = node.walk(); |
| 1345 | let has_arg_part = node.named_children(&mut cursor).any(|c| c.kind() == "argument_part"); |
| 1346 | if !has_arg_part { |
| 1347 | return None; |
| 1348 | } |
| 1349 | // Past comments: `box.grow /* by */ (3)` calls `box.grow`. |
| 1350 | let prev = prev_named(node)?; |
| 1351 | return self.callee_name(prev); |
| 1352 | } |
| 1353 | |
| 1354 | // A generic call the grammar read as two comparisons |
| 1355 | // (`ref.read<Repo>(p)`), named at its `<`, where a parsed call's |
| 1356 | // argument part starts. |
| 1357 | if node.kind() == "relational_operator" { |
| 1358 | let (callee, _) = self.misparsed_generic_call(node)?; |
| 1359 | return self.callee_name(callee); |
| 1360 | } |
| 1361 | |
| 1362 | // new_expression arm — DEAD in practice (the INSTANTIATION branch |
| 1363 | // fires first in the body walker); ported for fidelity. |
| 1364 | if node.kind() == "new_expression" { |
| 1365 | let mut cursor = node.walk(); |
| 1366 | let found = node |
| 1367 | .named_children(&mut cursor) |
| 1368 | .find(|c| c.kind() == "type_identifier") |
| 1369 | .map(|t| self.text(t).to_string()); |
| 1370 | return found; |
| 1371 | } |
| 1372 | |
| 1373 | // const EdgeInsets.all(8.0) — const constructor call. |
| 1374 | if node.kind() == "const_object_expression" { |
| 1375 | let mut c1 = node.walk(); |
| 1376 | let type_id = node.named_children(&mut c1).find(|c| c.kind() == "type_identifier"); |
| 1377 | let mut c2 = node.walk(); |
| 1378 | let name_id = node.named_children(&mut c2).find(|c| c.kind() == "identifier"); |
| 1379 | return match (type_id, name_id) { |
| 1380 | (Some(t), Some(n)) => Some(format!("{}.{}", self.text(t), self.text(n))), |
| 1381 | (Some(t), None) => Some(self.text(t).to_string()), |
| 1382 | _ => None, |
| 1383 | }; |
| 1384 | } |
| 1385 | |
| 1386 | // `=> BlocProvider<CounterCubit>.value(…)` — a constructor called |
| 1387 | // with type arguments, as most expressions parse it. The type is the |
| 1388 | // LAST type_identifier: an import prefix (`p.X<T>.named`) is one too. |
| 1389 | if node.kind() == "constructor_invocation" { |
| 1390 | let mut c1 = node.walk(); |
| 1391 | let type_id = node.named_children(&mut c1).filter(|c| c.kind() == "type_identifier").last(); |
| 1392 | let mut c2 = node.walk(); |
| 1393 | let name_id = node.named_children(&mut c2).find(|c| c.kind() == "identifier"); |
| 1394 | return match (type_id, name_id) { |
| 1395 | (Some(t), Some(n)) => Some(format!("{}.{}", self.text(t), self.text(n))), |
| 1396 | (Some(t), None) => Some(self.text(t).to_string()), |
| 1397 | _ => None, |
| 1398 | }; |
| 1399 | } |
no test coverage detected