(&mut self, node: Node<'t>)
| 1497 | } |
| 1498 | |
| 1499 | fn visit_for_calls_and_structure(&mut self, node: Node<'t>) { |
| 1500 | let kind = node.kind(); |
| 1501 | self.maybe_capture_fn_refs(node); |
| 1502 | |
| 1503 | if kind == "call_expression" { |
| 1504 | self.extract_call(node); |
| 1505 | } else if kind == "new_expression" { |
| 1506 | self.extract_instantiation(node); |
| 1507 | } |
| 1508 | |
| 1509 | // C++ stack construction `Calculator calc(0)` / `Widget w{1,2}` (#1035). |
| 1510 | if kind == "declaration" |
| 1511 | && self.variant == Variant::Cpp |
| 1512 | && self.is_cpp_stack_construction(node) |
| 1513 | { |
| 1514 | self.extract_instantiation(node); |
| 1515 | } |
| 1516 | |
| 1517 | // C++ local fn-pointer bindings: declarations and branch reassignments. |
| 1518 | if self.variant == Variant::Cpp && !self.stack.is_empty() { |
| 1519 | if kind == "declaration" { |
| 1520 | for i in 0..node.named_child_count() { |
| 1521 | let Some(child) = node.named_child(i) else { continue }; |
| 1522 | if child.kind() != "init_declarator" { |
| 1523 | continue; |
| 1524 | } |
| 1525 | let Some(decl) = child.child_by_field_name("declarator") else { continue }; |
| 1526 | if decl.kind() != "identifier" { |
| 1527 | continue; |
| 1528 | } |
| 1529 | let local = self.text(decl).to_string(); |
| 1530 | self.record_cpp_fn_ptr_binding(&local, child.child_by_field_name("value")); |
| 1531 | } |
| 1532 | } else if kind == "assignment_expression" { |
| 1533 | if let Some(left) = node.child_by_field_name("left") { |
| 1534 | if left.kind() == "identifier" { |
| 1535 | let local = self.text(left).to_string(); |
| 1536 | self.record_cpp_fn_ptr_binding(&local, node.child_by_field_name("right")); |
| 1537 | } |
| 1538 | } |
| 1539 | } |
| 1540 | } |
| 1541 | |
| 1542 | // Static-member / value-read: `Foo.BAR`, `Foo->x` (cpp). |
| 1543 | self.extract_static_member_ref(node); |
| 1544 | |
| 1545 | // Nested NAMED functions become their own nodes. |
| 1546 | if kind == "function_definition" { |
| 1547 | let nested_name = self.extract_name(node); |
| 1548 | if !nested_name.is_empty() && nested_name != "<anonymous>" { |
| 1549 | self.extract_function(node); |
| 1550 | return; |
| 1551 | } |
| 1552 | } |
| 1553 | |
| 1554 | // Structural nodes inside bodies (local classes; macro-misparse rescue). |
| 1555 | if self.variant == Variant::Cpp && kind == "class_specifier" { |
| 1556 | self.extract_class(node); |
no test coverage detected