(&mut self, node: Node<'t>)
| 1207 | // --- calls / instantiation ---------------------------------------------- |
| 1208 | |
| 1209 | fn extract_call(&mut self, node: Node<'t>) { |
| 1210 | if self.stack.is_empty() { |
| 1211 | return; |
| 1212 | } |
| 1213 | let caller_row = self.top_row(); |
| 1214 | let func = node |
| 1215 | .child_by_field_name("function") |
| 1216 | .or_else(|| node.named_child(0)); |
| 1217 | let calls_kind = edge_kind_index("calls").unwrap(); |
| 1218 | |
| 1219 | // C++ explicit operator call `a.operator+(b)` (#1247): the |
| 1220 | // operator_name hides in an ERROR child. (has_error() defers such |
| 1221 | // files to wasm, so this scan is a faithful no-op today.) |
| 1222 | if self.variant == Variant::Cpp { |
| 1223 | if let Some(func) = func { |
| 1224 | let mut operator_name = String::new(); |
| 1225 | 'err: for i in 0..node.named_child_count() { |
| 1226 | let Some(child) = node.named_child(i) else { continue }; |
| 1227 | if child.kind() != "ERROR" { |
| 1228 | continue; |
| 1229 | } |
| 1230 | for j in 0..child.named_child_count() { |
| 1231 | if let Some(op) = child.named_child(j) { |
| 1232 | if op.kind() == "operator_name" { |
| 1233 | operator_name = self.text(op).to_string(); |
| 1234 | break 'err; |
| 1235 | } |
| 1236 | } |
| 1237 | } |
| 1238 | } |
| 1239 | if !operator_name.is_empty() { |
| 1240 | let sym = operator_name["operator".len()..].trim().to_string(); |
| 1241 | if symbolic_op_re().is_match(&sym) { |
| 1242 | let compact: String = sym.chars().filter(|c| !c.is_whitespace()).collect(); |
| 1243 | operator_name = format!("operator{compact}"); |
| 1244 | } |
| 1245 | let receiver = arrow_dot_no_ws(self.text(func)); |
| 1246 | if receiver != "this" && !operator_receiver_re().is_match(&receiver) { |
| 1247 | return; |
| 1248 | } |
| 1249 | let callee = if receiver == "this" { |
| 1250 | operator_name |
| 1251 | } else { |
| 1252 | format!("{receiver}.{operator_name}") |
| 1253 | }; |
| 1254 | self.push_ref_at(caller_row, &callee, calls_kind, node); |
| 1255 | return; |
| 1256 | } |
| 1257 | } |
| 1258 | } |
| 1259 | |
| 1260 | let mut callee_name = String::new(); |
| 1261 | if let Some(func) = func { |
| 1262 | if func.kind() == "field_expression" { |
| 1263 | // `obj.method()` / `ptr->method()` — the `field` field. |
| 1264 | let property = func |
| 1265 | .child_by_field_name("property") |
| 1266 | .or_else(|| func.child_by_field_name("field")) |
no test coverage detected