Skip to main content

for_nodes

Function for_nodes 

Source
pub fn for_nodes(
    before_metadata: &ASTMetadata,
    after_metadata: &ASTMetadata,
    before_node_ids: Vec<usize>,
    after_node_ids: Vec<usize>,
    algorithm: Algorithm,
    source: &'static str,
    diff: &mut ASTDiff,
)
Expand description

Compute the optimal tree edit distance using a postorder, single-node-granularity Zhang-Shasha/APTED-style forest distance, given before/after node id lists.

source is a short, call-site-specific label (e.g. "fast_fallback", "qualified_name") recorded on every ASTMappingReason::APTED entry this resolution produces - see that variant’s doc comment. Every caller passes a distinct literal identifying which heuristic invoked APTED, so two APTED-reasoned mappings can be told apart by provenance, not just by the fact that APTED produced both.