MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / capture_value_ref_scope

Method capture_value_ref_scope

codegraph-kernel/src/tsjs/mod.rs:485–507  ·  view source on GitHub ↗
(&mut self, kind: &'static str, name: &str, row: u32, node: Node<'t>, value_target: bool)

Source from the content-addressed store, hash-verified

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);

Callers 1

create_nodeMethod · 0.45

Calls 3

utf16_lenFunction · 0.85
mapMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected