(&mut self, kind: &'static str, name: &str, row: u32, node: Node<'t>, value_target: bool)
| 483 | // --- value references (captureValueRefScope / flushValueRefs) -------------- |
| 484 | |
| 485 | fn capture_value_ref_scope(&mut self, kind: &'static str, name: &str, row: u32, node: Node<'t>, value_target: bool) { |
| 486 | let target_kind_ok = kind == "constant" || kind == "variable"; |
| 487 | if value_target |
| 488 | && target_kind_ok |
| 489 | && util::utf16_len(name) >= 3 |
| 490 | && util::has_upper_or_underscore().is_match(name) |
| 491 | { |
| 492 | let parent_ok = self |
| 493 | .stack |
| 494 | .last() |
| 495 | .map(|s| matches!(s.kind, "file" | "class" | "module" | "struct" | "enum")) |
| 496 | .unwrap_or(false); |
| 497 | if parent_ok { |
| 498 | self.fs_values.insert(name.to_string(), row); |
| 499 | *self.fs_value_counts.entry(name.to_string()).or_insert(0) += 1; |
| 500 | } |
| 501 | } |
| 502 | // A React wrapper component reads values as a constant's declaration |
| 503 | // does (`${BaseMenuItemCSS}` in a styled template). |
| 504 | if matches!(kind, "function" | "method" | "constant" | "variable" | "component") { |
| 505 | self.value_scopes.push(ValueScope { row, node, name: name.to_string() }); |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | fn flush_value_refs(&mut self, root: Node<'t>) { |
| 510 | let scopes = std::mem::take(&mut self.value_scopes); |
no test coverage detected