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

Method callers

atomic-repository/src/repository/syntax_index.rs:133–168  ·  view source on GitHub ↗
(&self, target: &str)

Source from the content-addressed store, hash-verified

131 }
132
133 pub fn callers(&self, target: &str) -> Vec<Caller> {
134 let (path, name) = target
135 .rsplit_once('#')
136 .map(|(path, name)| (Some(path), name))
137 .unwrap_or((None, target));
138 let targets: BTreeSet<_> = self
139 .entities
140 .iter()
141 .filter(|entity| {
142 callable(entity)
143 && entity.name == name
144 && path.is_none_or(|path| entity.file == path)
145 })
146 .map(selector)
147 .collect();
148 let callers: BTreeSet<_> = self
149 .calls
150 .iter()
151 .filter(|(callee, _)| targets.contains(callee))
152 .map(|(_, caller)| caller.as_str())
153 .collect();
154 let mut result: Vec<_> = self
155 .entities
156 .iter()
157 .filter(|entity| callable(entity) && callers.contains(selector(entity).as_str()))
158 .map(|entity| Caller {
159 path: entity.file.clone(),
160 name: entity.name.clone(),
161 line: entity.line,
162 summary: entity.signature.clone(),
163 })
164 .collect();
165 result.sort_by(|a, b| (&a.path, &a.name, a.line).cmp(&(&b.path, &b.name, b.line)));
166 result.dedup_by(|a, b| a.path == b.path && a.name == b.name && a.line == b.line);
167 result
168 }
169}
170
171impl Repository {

Callers 4

build_reportFunction · 0.80
query_callersMethod · 0.80
query_callers_on_viewMethod · 0.80
collect_callersFunction · 0.80

Calls 8

callableFunction · 0.85
selectorFunction · 0.85
collectMethod · 0.45
iterMethod · 0.45
containsMethod · 0.45
as_strMethod · 0.45
cloneMethod · 0.45
cmpMethod · 0.45

Tested by

no test coverage detected