(&mut self, node: Node<'t>)
| 1665 | // --- calls / instantiation ---------------------------------------------- |
| 1666 | |
| 1667 | fn extract_call(&mut self, node: Node<'t>) { |
| 1668 | if self.stack.is_empty() { |
| 1669 | return; |
| 1670 | } |
| 1671 | let caller_row = self.top_row(); |
| 1672 | let func = node |
| 1673 | .child_by_field_name("function") |
| 1674 | .or_else(|| node.named_child(0)); |
| 1675 | let calls_kind = edge_kind_index("calls").unwrap(); |
| 1676 | |
| 1677 | // C++ explicit operator call `a.operator+(b)` (#1247): the |
| 1678 | // operator_name hides in an ERROR child. (has_error() defers such |
| 1679 | // files to wasm, so this scan is a faithful no-op today.) |
| 1680 | if self.variant == Variant::Cpp { |
| 1681 | if let Some(func) = func { |
| 1682 | let mut operator_name = String::new(); |
| 1683 | 'err: for i in 0..node.named_child_count() { |
| 1684 | let Some(child) = node.named_child(i) else { continue }; |
| 1685 | if child.kind() != "ERROR" { |
| 1686 | continue; |
| 1687 | } |
| 1688 | for j in 0..child.named_child_count() { |
| 1689 | if let Some(op) = child.named_child(j) { |
| 1690 | if op.kind() == "operator_name" { |
| 1691 | operator_name = self.text(op).to_string(); |
| 1692 | break 'err; |
| 1693 | } |
| 1694 | } |
| 1695 | } |
| 1696 | } |
| 1697 | if !operator_name.is_empty() { |
| 1698 | let sym = operator_name["operator".len()..].trim().to_string(); |
| 1699 | if symbolic_op_re().is_match(&sym) { |
| 1700 | let compact: String = sym.chars().filter(|c| !c.is_whitespace()).collect(); |
| 1701 | operator_name = format!("operator{compact}"); |
| 1702 | } |
| 1703 | let receiver = arrow_dot_no_ws(self.text(func)); |
| 1704 | if receiver != "this" && !operator_receiver_re().is_match(&receiver) { |
| 1705 | return; |
| 1706 | } |
| 1707 | let callee = if receiver == "this" { |
| 1708 | operator_name |
| 1709 | } else { |
| 1710 | format!("{receiver}.{operator_name}") |
| 1711 | }; |
| 1712 | self.push_ref_at(caller_row, &callee, calls_kind, node); |
| 1713 | return; |
| 1714 | } |
| 1715 | } |
| 1716 | } |
| 1717 | |
| 1718 | let mut callee_name = String::new(); |
| 1719 | if let Some(func) = func { |
| 1720 | if func.kind() == "field_expression" { |
| 1721 | // `obj.method()` / `ptr->method()` — the `field` field. |
| 1722 | let property = func |
| 1723 | .child_by_field_name("property") |
| 1724 | .or_else(|| func.child_by_field_name("field")) |
no test coverage detected