Skip to main content

CountReferences

Function CountReferences 

Source
pub fn CountReferences(Target: &str, Stmts: &[Stmt]) -> (usize, bool, bool)
Expand description

Count references to Target in Stmts.

Returns (count, in_closure, in_loop).

  • count : number of times the identifier is referenced (plain expressions and macro token streams).
  • in_closure : true when at least one reference occurs inside a closure body (even if count == 1).
  • in_loop : true when at least one reference occurs inside the body of a for, while, or loop expression (even if count == 1).

Counting stops when a top-level let <target> = ... shadow is encountered.