maybeCaptureFnRefs + captureFnRefCandidates for the cFamily dispatch: argument_list(args), assignment_expression(rhs:right), init_declarator(varinit:value), initializer_list(list), initializer_pair(value:value).
(&mut self, node: Node<'t>)
| 2320 | /// init_declarator(varinit:value), initializer_list(list), |
| 2321 | /// initializer_pair(value:value). |
| 2322 | fn maybe_capture_fn_refs(&mut self, node: Node<'t>) { |
| 2323 | let mode = match node.kind() { |
| 2324 | "argument_list" => Mode::Args, |
| 2325 | "assignment_expression" => Mode::Rhs, |
| 2326 | "init_declarator" => Mode::Varinit, |
| 2327 | "initializer_list" => Mode::List, |
| 2328 | "initializer_pair" => Mode::Value, |
| 2329 | _ => return, |
| 2330 | }; |
| 2331 | if self.stack.is_empty() { |
| 2332 | return; |
| 2333 | } |
| 2334 | let from = self.top_row(); |
| 2335 | |
| 2336 | let mut values: Vec<Node<'t>> = Vec::new(); |
| 2337 | match mode { |
| 2338 | Mode::Args | Mode::List => { |
| 2339 | for i in 0..node.named_child_count() { |
| 2340 | if let Some(c) = node.named_child(i) { |
| 2341 | values.push(c); |
| 2342 | } |
| 2343 | } |
| 2344 | } |
| 2345 | Mode::Rhs => { |
| 2346 | if let Some(rhs) = node.child_by_field_name("right") { |
| 2347 | // Param-storage skip: `o->cb = cb` (LHS last name == RHS). |
| 2348 | let lhs_text = node |
| 2349 | .child_by_field_name("left") |
| 2350 | .map(|l| self.text(l)) |
| 2351 | .unwrap_or(""); |
| 2352 | let lhs_last = util::lhs_last_name() |
| 2353 | .captures(lhs_text) |
| 2354 | .and_then(|c| c.get(1)) |
| 2355 | .map(|m| m.as_str()); |
| 2356 | if !(lhs_last.is_some() && lhs_last == Some(self.text(rhs).trim())) { |
| 2357 | values.push(rhs); |
| 2358 | } |
| 2359 | } |
| 2360 | } |
| 2361 | Mode::Value => { |
| 2362 | let v = node.child_by_field_name("value").or_else(|| { |
| 2363 | if node.named_child_count() > 0 { |
| 2364 | node.named_child(node.named_child_count() - 1) |
| 2365 | } else { |
| 2366 | None |
| 2367 | } |
| 2368 | }); |
| 2369 | if let Some(v) = v { |
| 2370 | values.push(v); |
| 2371 | } |
| 2372 | } |
| 2373 | Mode::Varinit => { |
| 2374 | // (init_declarator has no name/pattern field — no destructure skip) |
| 2375 | if let Some(v) = node.child_by_field_name("value") { |
| 2376 | values.push(v); |
| 2377 | } |
| 2378 | } |
| 2379 | } |
no test coverage detected