dartCallee (dart.ts) — the callee name of the call whose argument part follows `prev`.
(&self, prev: Node<'t>)
| 1296 | /// dartCallee (dart.ts) — the callee name of the call whose argument part |
| 1297 | /// follows `prev`. |
| 1298 | fn callee_name(&self, prev: Node<'t>) -> Option<String> { |
| 1299 | if prev.kind() == "identifier" { |
| 1300 | return Some(self.text(prev).to_string()); |
| 1301 | } |
| 1302 | if prev.kind() == "selector" { |
| 1303 | let mut pc = prev.walk(); |
| 1304 | let accessor = prev.named_children(&mut pc).find(|c| { |
| 1305 | matches!( |
| 1306 | c.kind(), |
| 1307 | "unconditional_assignable_selector" | "conditional_assignable_selector" |
| 1308 | ) |
| 1309 | }); |
| 1310 | if let Some(accessor) = accessor { |
| 1311 | let mut ac = accessor.walk(); |
| 1312 | let method_id = accessor.named_children(&mut ac).find(|c| c.kind() == "identifier"); |
| 1313 | if let Some(method_id) = method_id { |
| 1314 | let accessor_prev = self.receiver_of(prev); |
| 1315 | if let Some(ap) = accessor_prev { |
| 1316 | if ap.kind() == "identifier" { |
| 1317 | return Some(format!("{}.{}", self.text(ap), self.text(method_id))); |
| 1318 | } |
| 1319 | // A constructor called with type arguments names |
| 1320 | // its type all the same (`BlocProvider<T>.value`). |
| 1321 | if let Some(type_name) = self.type_arguments_receiver(ap) { |
| 1322 | return Some(format!("{}.{}", type_name, self.text(method_id))); |
| 1323 | } |
| 1324 | // Chained static-factory: the receiver is itself |
| 1325 | // a call — re-encode `<inner>().<method>` when |
| 1326 | // the chain starts capitalized (#750). |
| 1327 | if ap.kind() == "selector" { |
| 1328 | let mut apc = ap.walk(); |
| 1329 | if ap.named_children(&mut apc).any(|c| c.kind() == "argument_part") { |
| 1330 | if let Some(inner) = self.callee_of_arg_part(ap) { |
| 1331 | if starts_upper_re().is_match(&inner) { |
| 1332 | return Some(format!("{}().{}", inner, self.text(method_id))); |
| 1333 | } |
| 1334 | } |
| 1335 | } |
| 1336 | } |
| 1337 | } |
| 1338 | return Some(self.text(method_id).to_string()); |
| 1339 | } |
| 1340 | } |
| 1341 | } |
| 1342 | // super.method() / this.method(): prev is a bare accessor. |
| 1343 | if matches!( |
| 1344 | prev.kind(), |
| 1345 | "unconditional_assignable_selector" | "conditional_assignable_selector" |
| 1346 | ) { |
| 1347 | let mut pc = prev.walk(); |
| 1348 | let id = prev.named_children(&mut pc).find(|c| c.kind() == "identifier"); |
| 1349 | if let Some(id) = id { |
| 1350 | return Some(self.text(id).to_string()); |
| 1351 | } |
| 1352 | } |
| 1353 | None |
| 1354 | } |
| 1355 |
no test coverage detected