MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / bind_calls

Method bind_calls

atomic-semantic/src/relationships.rs:625–668  ·  view source on GitHub ↗

Resolve retained lexical/import/owner evidence. A prior graph preserves references to removed declarations; presence and access remain separate.

(&'a self, before: Option<&'a Self>)

Source from the content-addressed store, hash-verified

623 /// Resolve retained lexical/import/owner evidence. A prior graph preserves
624 /// references to removed declarations; presence and access remain separate.
625 pub fn bind_calls<'a>(&'a self, before: Option<&'a Self>) -> Vec<BoundCall<'a>> {
626 let mut result = Vec::new();
627 for file in self.files.values() {
628 for call in &file.calls {
629 let strict = self.resolve(file, call, before, true);
630 let accessible = strict.is_some();
631 if let Some((id, reason)) =
632 strict.or_else(|| self.resolve(file, call, before, false))
633 {
634 let symbol = self.symbol(&id, before).expect("resolved symbol");
635 let explicit_receiver = usize::from(
636 file.language == Language::Rust
637 && symbol.receiver_parameter
638 && call.receiver.is_none(),
639 );
640 result.push(BoundCall {
641 call,
642 symbol,
643 present: self.symbols.contains_key(&id),
644 accessible,
645 expected_min: symbol.min + explicit_receiver,
646 expected_max: symbol.max.map(|max| max + explicit_receiver),
647 reason,
648 configuration_dependent: symbol.conditional
649 || self.conditional_path(&call.location.path)
650 || if self.symbols.contains_key(&id) {
651 self.conditional_path(&symbol.location.path)
652 } else {
653 before.is_some_and(|before| {
654 before.conditional_path(&symbol.location.path)
655 })
656 }
657 || self.symbols.get(&call.caller).is_some_and(|symbol| {
658 symbol.conditional || symbol.expansion_dependent
659 }),
660 });
661 }
662 }
663 }
664 result.sort_by(|a, b| {
665 (&a.call.location, &a.symbol.id).cmp(&(&b.call.location, &b.symbol.id))
666 });
667 result
668 }
669
670 fn conditional_path(&self, path: &str) -> bool {
671 self.placements

Calls 8

symbolMethod · 0.80
is_noneMethod · 0.80
contains_keyMethod · 0.80
conditional_pathMethod · 0.80
getMethod · 0.65
resolveMethod · 0.45
pushMethod · 0.45
cmpMethod · 0.45