(&mut self, kind: &'static str, name: &str, row: u32, node: Node<'t>)
| 416 | // --- value references (captureValueRefScope / flushValueRefs) -------------- |
| 417 | |
| 418 | fn capture_value_ref_scope(&mut self, kind: &'static str, name: &str, row: u32, node: Node<'t>) { |
| 419 | if !self.variant.value_refs() { |
| 420 | return; |
| 421 | } |
| 422 | let target_kind_ok = kind == "constant" || kind == "variable"; |
| 423 | if target_kind_ok |
| 424 | && util::utf16_len(name) >= 3 |
| 425 | && util::has_upper_or_underscore().is_match(name) |
| 426 | { |
| 427 | let parent_ok = self |
| 428 | .stack |
| 429 | .last() |
| 430 | .map(|s| matches!(s.kind, "file" | "class" | "module" | "struct" | "enum")) |
| 431 | .unwrap_or(false); |
| 432 | if parent_ok { |
| 433 | self.fs_values.insert(name.to_string(), row); |
| 434 | *self.fs_value_counts.entry(name.to_string()).or_insert(0) += 1; |
| 435 | } |
| 436 | } |
| 437 | if matches!(kind, "function" | "method" | "constant" | "variable") { |
| 438 | self.value_scopes.push(ValueScope { row, node, name: name.to_string() }); |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | fn flush_value_refs(&mut self, root: Node<'t>) { |
| 443 | let scopes = std::mem::take(&mut self.value_scopes); |
no test coverage detected