Problem
When indexing R code, all function names resolve to the literal string "function" instead of the actual function name. This causes ~49% of functions to have identical names, making search and tracing useless.
Root Cause
R defines functions via assignment: my_func <- function(x) { ... }. The pipeline extracts the right-hand side (function keyword) instead of the left-hand side (my_func).
Fix
Add an rFuncAssignName() function analogous to the existing luaFuncAssignName() in internal/pipeline/. The Lua version already solves the identical pattern — functions assigned to variables.
Look at luaFuncAssignName() for the pattern, then:
- Add
rFuncAssignName() that walks up from a function_definition node to its parent assignment and extracts the variable name
- Wire it into the pipeline switch statement in
extractVarNames / isModuleLevelNode
Test Repo
dplyr: https://github.com/tidyverse/dplyr
Impact
Fixes 5 of 5 R benchmark failures. Moves R from Tier D (11%) to usable.
References
- Benchmark report:
BENCHMARK_REPORT.md (R section)
- Lua analogue:
internal/pipeline/ — search for luaFuncAssignName
Problem
When indexing R code, all function names resolve to the literal string
"function"instead of the actual function name. This causes ~49% of functions to have identical names, making search and tracing useless.Root Cause
R defines functions via assignment:
my_func <- function(x) { ... }. The pipeline extracts the right-hand side (functionkeyword) instead of the left-hand side (my_func).Fix
Add an
rFuncAssignName()function analogous to the existingluaFuncAssignName()ininternal/pipeline/. The Lua version already solves the identical pattern — functions assigned to variables.Look at
luaFuncAssignName()for the pattern, then:rFuncAssignName()that walks up from afunction_definitionnode to its parent assignment and extracts the variable nameextractVarNames/isModuleLevelNodeTest Repo
dplyr: https://github.com/tidyverse/dplyr
Impact
Fixes 5 of 5 R benchmark failures. Moves R from Tier D (11%) to usable.
References
BENCHMARK_REPORT.md(R section)internal/pipeline/— search forluaFuncAssignName