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

Method callee_name

codegraph-kernel/src/dart.rs:1426–1482  ·  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

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

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