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

Method callee_name

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

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

Callers 1

bare_call_nameMethod · 0.45

Calls 6

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

Tested by

no test coverage detected