(&mut self, node: Node<'t>)
| 901 | // --- extractInstantiation (:4610, generic tail) ----------------------- |
| 902 | |
| 903 | fn extract_instantiation(&mut self, node: Node<'t>) { |
| 904 | if self.stack.is_empty() { |
| 905 | return; |
| 906 | } |
| 907 | let from_row = self.top_row(); |
| 908 | let ctor = node |
| 909 | .child_by_field_name("constructor") |
| 910 | .or_else(|| node.child_by_field_name("type")) |
| 911 | .or_else(|| node.child_by_field_name("name")) |
| 912 | .or_else(|| node.named_child(0)); |
| 913 | let Some(ctor) = ctor else { return }; |
| 914 | let mut class_name = self.text(ctor).to_string(); |
| 915 | if let Some(lt) = class_name.find('<') { |
| 916 | if lt > 0 { |
| 917 | class_name.truncate(lt); |
| 918 | } |
| 919 | } |
| 920 | let last_dot = class_name.rfind('.').map(|i| i as i64).unwrap_or(-1); |
| 921 | let last_colons = class_name.rfind("::").map(|i| (i + 1) as i64).unwrap_or(-1); |
| 922 | let last = last_dot.max(last_colons); |
| 923 | if last >= 0 { |
| 924 | class_name = class_name[(last as usize + 1)..].to_string(); |
| 925 | class_name = class_name.trim_start_matches([':', '.']).to_string(); |
| 926 | } |
| 927 | let class_name = class_name.trim().to_string(); |
| 928 | if class_name.is_empty() { |
| 929 | return; |
| 930 | } |
| 931 | self.push_ref_at(from_row, &class_name, "instantiates", node); |
| 932 | } |
| 933 | |
| 934 | // --- extractBareCall (dart.ts:305-379) -------------------------------- |
| 935 |
no test coverage detected