extractAnonymousClass — unreachable on v0.24.2 (the declaration_list nests inside `anonymous_class`, so findAnonymousClassBody finds no DIRECT child) — mirrored from the shared TS path for shape.
(&mut self, node: Node<'t>, body: Node<'t>)
| 1088 | /// nests inside `anonymous_class`, so findAnonymousClassBody finds no |
| 1089 | /// DIRECT child) — mirrored from the shared TS path for shape. |
| 1090 | fn extract_anonymous_class(&mut self, node: Node<'t>, body: Node<'t>) { |
| 1091 | stack_guard!(); |
| 1092 | let type_node = node |
| 1093 | .child_by_field_name("constructor") |
| 1094 | .or_else(|| node.child_by_field_name("type")) |
| 1095 | .or_else(|| node.child_by_field_name("name")) |
| 1096 | .or_else(|| node.named_child(0)); |
| 1097 | let mut type_name = |
| 1098 | type_node.map(|t| self.text(t).to_string()).unwrap_or_else(|| "Object".to_string()); |
| 1099 | type_name = strip_generic_and_qualifier(&type_name); |
| 1100 | if type_name.is_empty() { |
| 1101 | type_name = "Object".to_string(); |
| 1102 | } |
| 1103 | let anon_name = format!("<{type_name}$anon@{}>", node.start_position().row + 1); |
| 1104 | let Some(row) = self.create_node("class", &anon_name, node, Extra::default()) else { |
| 1105 | return; |
| 1106 | }; |
| 1107 | let (line, column) = match type_node { |
| 1108 | Some(t) => (t.start_position().row as u32, self.col_of(t)), |
| 1109 | None => (node.start_position().row as u32, self.col_of(node)), |
| 1110 | }; |
| 1111 | self.push_ref(row, &type_name, edge_kind_index("extends").unwrap(), line, column); |
| 1112 | self.stack.push(Scope { row, kind: "class", name: anon_name }); |
| 1113 | for i in 0..body.named_child_count() { |
| 1114 | if let Some(c) = body.named_child(i) { |
| 1115 | self.visit_node(c); |
| 1116 | } |
| 1117 | } |
| 1118 | self.stack.pop(); |
| 1119 | } |
| 1120 | |
| 1121 | /// extractStaticMemberRef — php's class_constant_access_expression + |
| 1122 | /// scoped_property_access_expression (member_access_expression is |
no test coverage detected