Skip to main content

python_is_lambda

Function python_is_lambda 

Source
pub fn python_is_lambda(node: &Node<'_>) -> bool
Expand description

Whether node is a Python lambda expression, under either of the grammar’s two aliased kind_ids: Lambda (196, the concrete production emitted today) and Lambda2 (197, the currently-unseen hidden alias). Lambda3 (73) is the lambda keyword token, not a closure node, and is intentionally excluded.

This is the single normalization chokepoint for the lambda-alias set — mirroring python_is_block for the block aliases (#419). It is reused by PythonCode::is_closure here and by the cognitive lambda-scope walks in big-code-analysis, so a future grammar bump that promotes Lambda2 to a concrete node is handled in exactly one place rather than drifting across sites (#422). The python_hidden_block_and_lambda_aliases_stay_unseen drift guard in checker.rs trips on such a bump.