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

Method capture_value_ref_scope

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

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