dartCallee (dart.ts) — the callee name of the call whose argument part follows `prev`.
(&self, prev: Node<'t>)
| 1424 | /// dartCallee (dart.ts) — the callee name of the call whose argument part |
| 1425 | /// follows `prev`. |
| 1426 | fn callee_name(&self, prev: Node<'t>) -> Option<String> { |
| 1427 | if prev.kind() == "identifier" { |
| 1428 | return Some(self.text(prev).to_string()); |
| 1429 | } |
| 1430 | if prev.kind() == "selector" { |
| 1431 | let mut pc = prev.walk(); |
| 1432 | let accessor = prev.named_children(&mut pc).find(|c| { |
| 1433 | matches!( |
| 1434 | c.kind(), |
| 1435 | "unconditional_assignable_selector" | "conditional_assignable_selector" |
| 1436 | ) |
| 1437 | }); |
| 1438 | if let Some(accessor) = accessor { |
| 1439 | let mut ac = accessor.walk(); |
| 1440 | let method_id = accessor.named_children(&mut ac).find(|c| c.kind() == "identifier"); |
| 1441 | if let Some(method_id) = method_id { |
| 1442 | let accessor_prev = self.receiver_of(prev); |
| 1443 | if let Some(ap) = accessor_prev { |
| 1444 | if ap.kind() == "identifier" { |
| 1445 | return Some(format!("{}.{}", self.text(ap), self.text(method_id))); |
| 1446 | } |
| 1447 | // A constructor called with type arguments names |
| 1448 | // its type all the same (`BlocProvider<T>.value`). |
| 1449 | if let Some(type_name) = self.type_arguments_receiver(ap) { |
| 1450 | return Some(format!("{}.{}", type_name, self.text(method_id))); |
| 1451 | } |
| 1452 | // Chained static-factory: the receiver is itself |
| 1453 | // a call — re-encode `<inner>().<method>` when |
| 1454 | // the chain starts capitalized (#750). |
| 1455 | if ap.kind() == "selector" { |
| 1456 | let mut apc = ap.walk(); |
| 1457 | if ap.named_children(&mut apc).any(|c| c.kind() == "argument_part") { |
| 1458 | if let Some(inner) = self.callee_of_arg_part(ap) { |
| 1459 | if starts_upper_re().is_match(&inner) { |
| 1460 | return Some(format!("{}().{}", inner, self.text(method_id))); |
| 1461 | } |
| 1462 | } |
| 1463 | } |
| 1464 | } |
| 1465 | } |
| 1466 | return Some(self.text(method_id).to_string()); |
| 1467 | } |
| 1468 | } |
| 1469 | } |
| 1470 | // super.method() / this.method(): prev is a bare accessor. |
| 1471 | if matches!( |
| 1472 | prev.kind(), |
| 1473 | "unconditional_assignable_selector" | "conditional_assignable_selector" |
| 1474 | ) { |
| 1475 | let mut pc = prev.walk(); |
| 1476 | let id = prev.named_children(&mut pc).find(|c| c.kind() == "identifier"); |
| 1477 | if let Some(id) = id { |
| 1478 | return Some(self.text(id).to_string()); |
| 1479 | } |
| 1480 | } |
| 1481 | None |
| 1482 | } |
| 1483 |
no test coverage detected