Commit af0fb4d
authored
fix(native/cpp): strip reference modifier from parameter names (#1192)
* fix(native/cpp): strip reference modifier from parameter names
tree-sitter-cpp's `reference_declarator` rule (covering `&` and `&&`)
doesn't expose a `declarator` field, so `child_by_field_name("declarator")`
returns None and `unwrap_cpp_declarator` falls through to emitting the full
node text (`& action`). Native C++ parameter nodes ended up named
`& action` while WASM emitted `action`, producing divergent `contains` and
`parameter_of` edges across engines.
Fall back to scanning children for the next nested declarator or identifier
when the field lookup misses. Covers lvalue (`int& x`) and rvalue
(`int&& x`) references, and applies transitively to fields, type-map entries,
and function-name extraction since they all route through the helper.
Closes #1187
* fix(native/cpp): drop function_declarator from declarator-child fallback (#1192)
unwrap_cpp_declarator's main loop has no arm for function_declarator, so
including it in next_cpp_declarator_child's match list stalls the loop
on a node it cannot unwrap and emits the full node text (e.g.
`callback(int)` instead of `callback`) for exotic parameter types like
`void (&callback)(int)`. Removing it lets the loop break cleanly and
fall back to node_text without the extra detour through a node kind it
does not handle.1 parent d447071 commit af0fb4d
1 file changed
Lines changed: 47 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
75 | 82 | | |
76 | 83 | | |
77 | 84 | | |
| |||
84 | 91 | | |
85 | 92 | | |
86 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
87 | 111 | | |
88 | 112 | | |
89 | 113 | | |
| |||
433 | 457 | | |
434 | 458 | | |
435 | 459 | | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
436 | 482 | | |
0 commit comments