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

Method normalize_fn_ref_value

codegraph-kernel/src/csharp.rs:1364–1398  ·  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

1362 /// normalizeValue (function-ref.ts:525) for CSHARP_SPEC: bare identifiers,
1363 /// the transparent `argument` layer, and the `this.Member` special.
1364 fn normalize_fn_ref_value(&mut self, v: Node<'t>, from: u32, depth: u32) {
1365 if depth > 4 {
1366 return;
1367 }
1368 match v.kind() {
1369 "identifier" => {
1370 let name = self.text(v);
1371 self.push_fn_ref_cand(from, name, v);
1372 }
1373 "argument" => {
1374 // Transparent layer (field=null) → recurse all named children.
1375 for i in 0..v.named_child_count() {
1376 if let Some(c) = v.named_child(i) {
1377 self.normalize_fn_ref_value(c, from, depth + 1);
1378 }
1379 }
1380 }
1381 "member_access_expression" => {
1382 // `this.Run0` — receiver must be EXACTLY `this` (the vendored
1383 // grammar yields the anonymous `this` token via the field;
1384 // text-prefix fallback for field-less shapes). Candidate is
1385 // the BARE member name at the name node's position.
1386 let Some(name_node) = v.child_by_field_name("name") else { return };
1387 let is_this = match v.child_by_field_name("expression") {
1388 Some(e) => e.kind() == "this_expression" || e.kind() == "this",
1389 None => self.text(v).starts_with("this."),
1390 };
1391 if is_this {
1392 let name = self.text(name_node);
1393 self.push_fn_ref_cand(from, name, name_node);
1394 }
1395 }
1396 _ => {}
1397 }
1398 }
1399
1400 fn push_fn_ref_cand(&mut self, from: u32, name: &str, node: Node) {
1401 if name.is_empty() || is_stoplisted(name) {

Callers 1

maybe_capture_fn_refsMethod · 0.45

Calls 2

textMethod · 0.45
push_fn_ref_candMethod · 0.45

Tested by

no test coverage detected