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

Method local

atomic-semantic/src/relationships.rs:333–372  ·  view source on GitHub ↗
(
        &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,

Callers 1

resolveMethod · 0.45

Calls 6

symbolMethod · 0.80
is_noneMethod · 0.80
cloneMethod · 0.45
pushMethod · 0.45
containsMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected