Method
local
(
&self,
file: &SourceAnalysis,
caller: &Symbol,
call: &CallSite,
before: Option<&Self>,
)
Source from the content-addressed store, hash-verified
| 331 | } |
| 332 | |
| 333 | fn local( |
| 334 | &self, |
| 335 | file: &SourceAnalysis, |
| 336 | caller: &Symbol, |
| 337 | call: &CallSite, |
| 338 | before: Option<&Self>, |
| 339 | ) -> Option<String> { |
| 340 | let name = call.target.first()?; |
| 341 | let mut scope = caller.scope.clone(); |
| 342 | scope.push(caller.entity.name.clone()); |
| 343 | loop { |
| 344 | let id = format!( |
| 345 | "{}#{}", |
| 346 | file.path, |
| 347 | scope |
| 348 | .iter() |
| 349 | .chain(std::iter::once(name)) |
| 350 | .cloned() |
| 351 | .collect::<Vec<_>>() |
| 352 | .join("::") |
| 353 | ); |
| 354 | if self.ambiguous.contains(&id) { |
| 355 | return None; |
| 356 | } |
| 357 | if let Some(symbol) = self.symbol(&id, before).filter(|symbol| { |
| 358 | symbol.owner.is_none() && symbol.entity.kind != crate::EntityKind::Method |
| 359 | }) { |
| 360 | if call.start_byte >= symbol.lexical_range.0 |
| 361 | && call.start_byte <= symbol.lexical_range.1 |
| 362 | { |
| 363 | return Some(id); |
| 364 | } |
| 365 | } |
| 366 | if scope.len() <= caller.module_scope.len() { |
| 367 | break; |
| 368 | } |
| 369 | scope.pop(); |
| 370 | } |
| 371 | None |
| 372 | } |
| 373 | |
| 374 | fn resolve( |
| 375 | &self, |
Tested by
no test coverage detected