Skip to main content

python_is_block

Function python_is_block 

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

Single normalization point for Python’s aliased block kind_ids.

tree-sitter-python lists two kind_ids that both stringify to "block": Block (135, the hidden _block supertype) and Block2 (160, the concrete production). Empirically only Block2 is ever emitted for real block bodies (function, class, if/for, while/try/with), so Block is dead today — but a future grammar bump could promote the supertype to a concrete node. Routing every “is this a block?” check through here means such a bump is handled at one site instead of silently undercounting at several (issue #419; lesson 2 / 34 / 56 in docs/development/lessons_learned.md).