pub fn lambda_anchors(src: &str) -> Option<Vec<(usize, usize)>>Expand description
(line, 1-based char col) of each lambda keyword token, in source order.
Returns Some(anchors) on success and None if tokenization fails.
§Precondition
src MUST be the same (BOM-stripped) buffer that parse_module already
accepted. Tokenizing is a strict subset of parsing, so any src that parsed
also tokenizes; in practice this function therefore always returns Some(…).
The None branch exists to close the silent-drop hole that the old
unwrap_or_default() created: if tokenization ever fails we now propagate the
failure to the caller (PythonFrontend::analyze) so it can emit a Diagnostic
and skip the file rather than silently emitting zero anchors and misattributing
(or omitting) every lambda.
§Double-tokenize elimination
The caller passes the returned &[(usize, usize)] slice directly into
functions::collect, so tokenization happens exactly once per file — the
old design called lambda_anchors a second time in PythonFrontend::analyze
for the mismatch guard, producing two tokenizer passes per file.