(&mut self, node: Node<'t>)
| 1072 | } |
| 1073 | |
| 1074 | fn extract_instantiation(&mut self, node: Node<'t>) { |
| 1075 | if self.stack.is_empty() { |
| 1076 | return; |
| 1077 | } |
| 1078 | let ctor = node |
| 1079 | .child_by_field_name("constructor") |
| 1080 | .or_else(|| node.child_by_field_name("type")) |
| 1081 | .or_else(|| node.child_by_field_name("name")) |
| 1082 | .or_else(|| node.named_child(0)); |
| 1083 | let Some(ctor) = ctor else { return }; |
| 1084 | // `new List<Foo>()` → `List`; `new Ns.Foo()` → `Foo`. Target-typed |
| 1085 | // `new()` / anonymous `new { }` / arrays `new T[n]` never reach here |
| 1086 | // (not in INSTANTIATION_KINDS) — invisible by design. |
| 1087 | let class_name = strip_generic_and_qualifier(self.text(ctor)); |
| 1088 | if !class_name.is_empty() { |
| 1089 | let from = self.top_row(); |
| 1090 | self.push_ref_at(from, &class_name, edge_kind_index("instantiates").unwrap(), node); |
| 1091 | } |
| 1092 | } |
| 1093 | |
| 1094 | /// extractAnonymousClass — `new T() { ... }`. The C# grammar never |
| 1095 | /// produces a class_body/declaration_list child on object_creation |
no test coverage detected