Skip to main content

declarator_name

Function declarator_name 

Source
pub fn declarator_name<'tree, T: Checker>(
    node: &Node<'tree>,
) -> Option<Node<'tree>>
Expand description

The node spelling a C-family function’s name.

It is the declarator field of innermost_declarator, and it is a separate function only so the four get_func_space_name impls state that pairing once instead of four times. Each caller still gates the result on its own grammar’s identifier kinds: what counts as a name is where C, C++ and Objective-C differ (destructor_name, qualified_identifier, operator_name, template_function), and a kind this module accepted on their behalf would be a claim about four grammars made in a module that reads none of them.

The macro shape innermost_declarator stops at is the one place the name and the arity come off different nodes. There that declarator field is the macro invocation — itself a function_declarator, which no getter’s identifier gate accepts — so the walk descends through it to the identifier the macro spells. RUN_STATS_METHOD is the only name in the source: the real Java_…_allocate exists only after ## pasting, and it is the token a reader greps for. This is why the module doc states the invariant per function rather than per node (#1213).