pub fn extract(
unit: &FnUnit<'_>,
imports: &Imports,
span: &SpanIndex<'_>,
referencing_module: &[String],
referencing_is_package: bool,
module_map: &PyModuleMap,
) -> Vec<CallSiteRef>Expand description
Extract all outgoing call references from unit’s own body.
For each call node encountered:
base = render_expr(&call.func)(e.g."os.getcwd","self.method","foo"). Calls whererender_exprreturnsNoneare skipped.root = base.split('.').next();module = imports.resolve(root).qualified = module.is_some()— the Python rule.kind = RefKind::Methodifbase.contains('.')ANDmodule.is_none()(a receiver attribute/method likeself.foo/x.bar); elseRefKind::Free.line/colfrom theleftmost_nameanchor via the span.resolved_targetvia the unified expand-split-resolve rule (see brief §5.3): Step A: expandbaseto a full dotted path usingimports.resolve(root), distinguishing theimport a.b.cform (R is a segment-boundary prefix of base → use base as-is) from thefrom m import nform (R is not a prefix → replace root with R, keep trailing members). Step B: split full intotarget_module+name. Step C: resolvetarget_modulevia the map (relative ifimports.relative_level(root)is Some, else absolute) and emit[..key, name]on a hit; elseNone.