(&mut self, node: Node<'t>)
| 1202 | } |
| 1203 | |
| 1204 | fn extract_instantiation(&mut self, node: Node<'t>) { |
| 1205 | if self.stack.is_empty() { |
| 1206 | return; |
| 1207 | } |
| 1208 | let ctor = node |
| 1209 | .child_by_field_name("constructor") |
| 1210 | .or_else(|| node.child_by_field_name("type")) |
| 1211 | .or_else(|| node.child_by_field_name("name")) |
| 1212 | .or_else(|| node.named_child(0)); |
| 1213 | let Some(ctor) = ctor else { return }; |
| 1214 | // `new List<Foo>()` → `List`; `new Ns.Foo()` → `Foo`. Target-typed |
| 1215 | // `new()` / anonymous `new { }` / arrays `new T[n]` never reach here |
| 1216 | // (not in INSTANTIATION_KINDS) — invisible by design, except a `new()` |
| 1217 | // that initializes a field or property (extract_target_typed_new). |
| 1218 | let class_name = strip_generic_and_qualifier(self.text(ctor)); |
| 1219 | if !class_name.is_empty() { |
| 1220 | let from = self.top_row(); |
| 1221 | self.push_ref_at(from, &class_name, edge_kind_index("instantiates").unwrap(), node); |
| 1222 | } |
| 1223 | } |
| 1224 | |
| 1225 | /// extractAnonymousClass — `new T() { ... }`. The C# grammar never |
| 1226 | /// produces a class_body/declaration_list child on object_creation |
no test coverage detected