extractInstantiation's composite_literal branch: named struct types only; the package qualifier is KEPT.
(&mut self, node: Node<'t>)
| 933 | /// extractInstantiation's composite_literal branch: named struct types |
| 934 | /// only; the package qualifier is KEPT. |
| 935 | fn extract_instantiation(&mut self, node: Node<'t>) { |
| 936 | if self.stack.is_empty() { |
| 937 | return; |
| 938 | } |
| 939 | let ctor = node |
| 940 | .child_by_field_name("constructor") |
| 941 | .or_else(|| node.child_by_field_name("type")) |
| 942 | .or_else(|| node.child_by_field_name("name")) |
| 943 | .or_else(|| node.named_child(0)); |
| 944 | let Some(ctor) = ctor else { return }; |
| 945 | if !matches!(ctor.kind(), "type_identifier" | "qualified_type") { |
| 946 | return; |
| 947 | } |
| 948 | let mut go_type = self.text(ctor).trim().to_string(); |
| 949 | if let Some(br) = go_type.find('[') { |
| 950 | if br > 0 { |
| 951 | go_type.truncate(br); |
| 952 | go_type = go_type.trim().to_string(); |
| 953 | } |
| 954 | } |
| 955 | if !go_type.is_empty() { |
| 956 | let from = self.top_row(); |
| 957 | self.push_ref_at(from, &go_type, edge_kind_index("instantiates").unwrap(), node); |
| 958 | } |
| 959 | } |
| 960 | |
| 961 | /// goEmbeddedTypeName (languages/go.ts): the name node of the type an |
| 962 | /// embedding names — `T`, `*T` (the `*` is a sibling token), `pkg.T` and |
no test coverage detected