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

Method capture_value_ref_scope

codegraph-kernel/src/tsjs/mod.rs:504–526  ·  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

502 // --- value references (captureValueRefScope / flushValueRefs) --------------
503
504 fn capture_value_ref_scope(&mut self, kind: &'static str, name: &str, row: u32, node: Node<'t>, value_target: bool) {
505 let target_kind_ok = kind == "constant" || kind == "variable";
506 if value_target
507 && target_kind_ok
508 && util::utf16_len(name) >= 3
509 && util::has_upper_or_underscore().is_match(name)
510 {
511 let parent_ok = self
512 .stack
513 .last()
514 .map(|s| matches!(s.kind, "file" | "class" | "module" | "struct" | "enum"))
515 .unwrap_or(false);
516 if parent_ok {
517 self.fs_values.insert(name.to_string(), row);
518 *self.fs_value_counts.entry(name.to_string()).or_insert(0) += 1;
519 }
520 }
521 // A React wrapper component reads values as a constant's declaration
522 // does (`${BaseMenuItemCSS}` in a styled template).
523 if matches!(kind, "function" | "method" | "constant" | "variable" | "component") {
524 self.value_scopes.push(ValueScope { row, node, name: name.to_string() });
525 }
526 }
527
528 fn flush_value_refs(&mut self, root: Node<'t>) {
529 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