(&mut self, node: Node<'t>)
| 1186 | } |
| 1187 | |
| 1188 | fn extract_instantiation(&mut self, node: Node<'t>) { |
| 1189 | if self.stack.is_empty() { |
| 1190 | return; |
| 1191 | } |
| 1192 | let ctor = node |
| 1193 | .child_by_field_name("constructor") |
| 1194 | .or_else(|| node.child_by_field_name("type")) |
| 1195 | .or_else(|| node.child_by_field_name("name")) |
| 1196 | .or_else(|| node.named_child(0)); |
| 1197 | let Some(ctor) = ctor else { return }; |
| 1198 | // `new List<Foo>()` → `List`; `new Ns.Foo()` → `Foo`. Target-typed |
| 1199 | // `new()` / anonymous `new { }` / arrays `new T[n]` never reach here |
| 1200 | // (not in INSTANTIATION_KINDS) — invisible by design, except a `new()` |
| 1201 | // that initializes a field or property (extract_target_typed_new). |
| 1202 | let class_name = strip_generic_and_qualifier(self.text(ctor)); |
| 1203 | if !class_name.is_empty() { |
| 1204 | let from = self.top_row(); |
| 1205 | self.push_ref_at(from, &class_name, edge_kind_index("instantiates").unwrap(), node); |
| 1206 | } |
| 1207 | } |
| 1208 | |
| 1209 | /// extractAnonymousClass — `new T() { ... }`. The C# grammar never |
| 1210 | /// produces a class_body/declaration_list child on object_creation |
no test coverage detected