Skip to main content

find_references_codebase

Function find_references_codebase 

Source
pub fn find_references_codebase(
    word: &str,
    all_docs: &[(Url, Arc<ParsedDoc>)],
    include_declaration: bool,
    kind: Option<SymbolKind>,
    codebase: &Codebase,
    lookup_refs: &RefLookup<'_>,
) -> Option<Vec<Location>>
Expand description

Fast path: look up pre-computed reference locations from the mir codebase index.

Handles Function, Class, and (partially) Method kinds. For Function and Class the mir analyzer records every call-site / instantiation via mark_*_referenced_at and the index is authoritative.

For Method, the index is used as a pre-filter: only files that contain a tracked call site for the method are scanned with the AST walker. This fast path is activated for two cases where the tracked set is reliably complete or narrows the search scope without missing real references: • private methods — PHP semantics guarantee that private methods are only callable from within the class body, so mir always resolves the receiver type. • methods on final classes — no subclassing means call sites on the concrete type are unambiguous; the codebase set covers all statically-typed callers.

Returns None for public/protected methods on non-final classes and for None kind (caller should use the general AST walker instead). Also returns None when no matching symbol is found in the codebase.