Skip to main content

declaration_declarator

Function declaration_declarator 

Source
pub fn declaration_declarator<'tree>(
    declaration: Node<'tree>,
    child: Node<'tree>,
) -> Option<Node<'tree>>
Expand description

Returns the declarator represented by one direct child of a declaration.

Tree-sitter exposes the first declarator through the declarator field, but subsequent comma-separated declarators are unfielded direct children: int first, second; therefore has an identifier child for first and a second, otherwise identical, identifier child for second. Consumers must inspect both shapes or a later declarator can be mistaken for a use of an unrelated indexed symbol.