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)
| 1504 | /// normalizeValue (function-ref.ts:525) for CSHARP_SPEC: bare identifiers, |
| 1505 | /// the transparent `argument` layer, and the `this.Member` special. |
| 1506 | fn normalize_fn_ref_value(&mut self, v: Node<'t>, from: u32, depth: u32) { |
| 1507 | stack_guard!(); |
| 1508 | if depth > 4 { |
| 1509 | return; |
| 1510 | } |
| 1511 | match v.kind() { |
| 1512 | "identifier" => { |
| 1513 | let name = self.text(v); |
| 1514 | self.push_fn_ref_cand(from, name, v); |
| 1515 | } |
| 1516 | "argument" => { |
| 1517 | // Transparent layer (field=null) → recurse all named children. |
| 1518 | for i in 0..v.named_child_count() { |
| 1519 | if let Some(c) = v.named_child(i) { |
| 1520 | self.normalize_fn_ref_value(c, from, depth + 1); |
| 1521 | } |
| 1522 | } |
| 1523 | } |
| 1524 | "member_access_expression" => { |
| 1525 | // `this.Run0` — receiver must be EXACTLY `this` (the vendored |
| 1526 | // grammar yields the anonymous `this` token via the field; |
| 1527 | // text-prefix fallback for field-less shapes). Candidate is |
| 1528 | // the BARE member name at the name node's position. |
| 1529 | let Some(name_node) = v.child_by_field_name("name") else { return }; |
| 1530 | let is_this = match v.child_by_field_name("expression") { |
| 1531 | Some(e) => e.kind() == "this_expression" || e.kind() == "this", |
| 1532 | None => self.text(v).starts_with("this."), |
| 1533 | }; |
| 1534 | if is_this { |
| 1535 | let name = self.text(name_node); |
| 1536 | self.push_fn_ref_cand(from, name, name_node); |
| 1537 | } else { |
| 1538 | // A method group through a receiver, `worker.Run` (#2906): |
| 1539 | // the receiver kept, a `this.` before a field dropped; it |
| 1540 | // skips the name gate (flush_fn_ref_candidates). |
| 1541 | let stripped = strip_js_ws(self.text(v)); |
| 1542 | let value = stripped.strip_prefix("this.").unwrap_or(&stripped).to_string(); |
| 1543 | if member_value_re().is_match(&value) { |
| 1544 | self.push_fn_ref_cand(from, &value, name_node); |
| 1545 | } |
| 1546 | } |
| 1547 | } |
| 1548 | _ => {} |
| 1549 | } |
| 1550 | } |
| 1551 | |
| 1552 | fn push_fn_ref_cand(&mut self, from: u32, name: &str, node: Node) { |
| 1553 | if name.is_empty() || is_stoplisted(name) { |
no test coverage detected