Skip to main content

usage_analysis

Function usage_analysis 

Source
pub fn usage_analysis(
    module: &Module,
    decl_name: &str,
    min_vis: Visibility,
    already_used: &mut UsedItems,
    to_analyze: &mut UsedItems,
    ignore_visibility: bool,
) -> Result<(), UsageError>
Expand description

Find declaration names which a local declaration depends on.

Adds external referenced idents to to_analyze with their minimum required visibility. Perform usage analysis recursively with local referenced idents, and adds them to already_used with their declaration visibility. So at the end of the call, to_analyze contains incomplete usage analysis which needs to continue in a separate module. already_used contains finished analysis.

min_vis is the minimum visibility requirement for the declaration.

Returns UsageError::NotFound if the declaration is not found. Returns UsageError::Visibility if the declaration is found, but does not have the required visibility.