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

Method normalize_fn_ref_value

codegraph-kernel/src/csharp.rs:1490–1525  ·  view source on GitHub ↗

normalizeValue (function-ref.ts:525) for CSHARP_SPEC: bare identifiers, the transparent `argument` layer, and the `this.Member` special.

(&mut self, v: Node<'t>, from: u32, depth: u32)

Source from the content-addressed store, hash-verified

1488 /// normalizeValue (function-ref.ts:525) for CSHARP_SPEC: bare identifiers,
1489 /// the transparent `argument` layer, and the `this.Member` special.
1490 fn normalize_fn_ref_value(&mut self, v: Node<'t>, from: u32, depth: u32) {
1491 stack_guard!();
1492 if depth > 4 {
1493 return;
1494 }
1495 match v.kind() {
1496 "identifier" => {
1497 let name = self.text(v);
1498 self.push_fn_ref_cand(from, name, v);
1499 }
1500 "argument" => {
1501 // Transparent layer (field=null) → recurse all named children.
1502 for i in 0..v.named_child_count() {
1503 if let Some(c) = v.named_child(i) {
1504 self.normalize_fn_ref_value(c, from, depth + 1);
1505 }
1506 }
1507 }
1508 "member_access_expression" => {
1509 // `this.Run0` — receiver must be EXACTLY `this` (the vendored
1510 // grammar yields the anonymous `this` token via the field;
1511 // text-prefix fallback for field-less shapes). Candidate is
1512 // the BARE member name at the name node's position.
1513 let Some(name_node) = v.child_by_field_name("name") else { return };
1514 let is_this = match v.child_by_field_name("expression") {
1515 Some(e) => e.kind() == "this_expression" || e.kind() == "this",
1516 None => self.text(v).starts_with("this."),
1517 };
1518 if is_this {
1519 let name = self.text(name_node);
1520 self.push_fn_ref_cand(from, name, name_node);
1521 }
1522 }
1523 _ => {}
1524 }
1525 }
1526
1527 fn push_fn_ref_cand(&mut self, from: u32, name: &str, node: Node) {
1528 if name.is_empty() || is_stoplisted(name) {

Callers 1

maybe_capture_fn_refsMethod · 0.45

Calls 2

textMethod · 0.65
push_fn_ref_candMethod · 0.45

Tested by

no test coverage detected