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