(&mut self, n: Node<'t>, decorated_row: u32)
| 2464 | } |
| 2465 | |
| 2466 | fn consider_decorator(&mut self, n: Node<'t>, decorated_row: u32) { |
| 2467 | if !matches!(n.kind(), "decorator" | "annotation" | "marker_annotation" | "attribute") { |
| 2468 | return; |
| 2469 | } |
| 2470 | let mut target: Option<Node> = None; |
| 2471 | for child in n.named_children(&mut n.walk()) { |
| 2472 | if child.kind() == "call_expression" { |
| 2473 | target = child.child_by_field_name("function").or_else(|| child.named_child(0)); |
| 2474 | if target.is_some() { |
| 2475 | break; |
| 2476 | } |
| 2477 | } |
| 2478 | if matches!( |
| 2479 | child.kind(), |
| 2480 | "identifier" | "member_expression" | "scoped_identifier" | "navigation_expression" |
| 2481 | | "user_type" | "type_identifier" |
| 2482 | ) { |
| 2483 | target = Some(child); |
| 2484 | break; |
| 2485 | } |
| 2486 | } |
| 2487 | let Some(target) = target else { return }; |
| 2488 | let mut name = self.text(target).to_string(); |
| 2489 | if let Some(lt) = name.find('<') { |
| 2490 | if lt > 0 { |
| 2491 | name.truncate(lt); |
| 2492 | } |
| 2493 | } |
| 2494 | let last_dot = name |
| 2495 | .rfind('.') |
| 2496 | .map(|i| i as isize) |
| 2497 | .unwrap_or(-1) |
| 2498 | .max(name.rfind("::").map(|i| i as isize).unwrap_or(-1)); |
| 2499 | if last_dot >= 0 { |
| 2500 | name = name[(last_dot as usize + 1)..].to_string(); |
| 2501 | if name.starts_with(':') || name.starts_with('.') { |
| 2502 | name.remove(0); |
| 2503 | } |
| 2504 | } |
| 2505 | let name = name.trim().to_string(); |
| 2506 | if name.is_empty() { |
| 2507 | return; |
| 2508 | } |
| 2509 | self.push_ref(decorated_row, &name, edge_kind_index("decorates").unwrap(), n); |
| 2510 | } |
| 2511 | |
| 2512 | // --- extractInheritance (TS/JS clauses) --------------------------------------------------- |
| 2513 |
no test coverage detected