MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / callee_name

Method callee_name

codegraph-kernel/src/dart.rs:1419–1475  ·  view source on GitHub ↗

dartCallee (dart.ts) — the callee name of the call whose argument part follows `prev`.

(&self, prev: Node<'t>)

Source from the content-addressed store, hash-verified

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

Callers 1

bare_call_nameMethod · 0.45

Calls 6

receiver_ofMethod · 0.80
callee_of_arg_partMethod · 0.80
starts_upper_reFunction · 0.70
textMethod · 0.65
walkMethod · 0.45

Tested by

no test coverage detected