Resolve callers from the selected view's recorded source using the same request-scoped parser as working-copy caller queries. No KG code edges are created or required. Accepts ` # ` or a bare symbol.
(
&self,
view_name: &str,
target: &str,
)
| 259 | /// request-scoped parser as working-copy caller queries. No KG code edges |
| 260 | /// are created or required. Accepts `<path>#<symbol>` or a bare symbol. |
| 261 | pub fn query_callers_on_view( |
| 262 | &self, |
| 263 | view_name: &str, |
| 264 | target: &str, |
| 265 | ) -> Result<Vec<Caller>, RepositoryError> { |
| 266 | let scope = self.query_view(view_name)?; |
| 267 | let mut sources = Vec::new(); |
| 268 | for (path, (inode, position)) in &scope.files { |
| 269 | let bytes = match super::content::retrieve_span_if_present( |
| 270 | &scope.txn, |
| 271 | &self.change_store, |
| 272 | *inode, |
| 273 | &scope.visibility, |
| 274 | )? { |
| 275 | Some(content) => content, |
| 276 | None => super::content::retrieve_content_with_filter_fast( |
| 277 | &scope.txn, |
| 278 | &self.change_store, |
| 279 | *inode, |
| 280 | *position, |
| 281 | atomic_core::output::alive::RetrieveOptions::new() |
| 282 | .with_graph_visibility(scope.visibility.clone()), |
| 283 | ) |
| 284 | .map_err(|error| RepositoryError::Database(error.to_string()))?, |
| 285 | }; |
| 286 | if let Ok(source) = String::from_utf8(bytes) { |
| 287 | sources.push((path.clone(), source)); |
| 288 | } |
| 289 | } |
| 290 | Ok(SyntaxIndex::from_sources(&sources).callers(target)) |
| 291 | } |
| 292 | } |