Repository navigation
Conversation
Signed-off-by: Antonio Espinosa <antespi@gmail.com>
Signed-off-by: Antonio Espinosa <antespi@gmail.com>
Named re-exports (export { a as b } from './m') and star re-exports
(export * from './m') are now recorded as re-export imports instead of
one module-level import. JS and TS call resolution uses the cross-file
import map, so a call through a barrel file reaches the function's
defining file, renames included.
Builds on the index.ts barrel commit from DeusData#2402. Covers the rename and
export * cases in DeusData#2718 and DeusData#1557.
Signed-off-by: chidev <chicagowebdev@gmail.com>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
The barrel walker kept a visited set of file QNs. A barrel with both
`export * from './m'` and `export { a as b } from './m'` searched m for
`b` through the star edge first, marked m visited, and then skipped m
when the renamed edge asked for `a`. The call to `b` got no edge.
The visited set is now keyed on (file QN, name). Each key is an owned
string stored as its own value and freed with the table.
Tested: new lrp_ts_barrel_star_and_renamed_same_module fails before
(renamed=0) and passes after.
Suites extraction_imports, edge_imports, path_alias, mcp,
lsp_resolution_probe: 626 passed, 4 skipped. The issue repro binds both
calls at 0.95.
Signed-off-by: chidev <chicagowebdev@gmail.com>
Formats the changed lines with clang-format 20.1.8, drops a condition that is always true (pass_calls.c), and narrows the scope of public_name (pass_lsp_cross.c), as the lint job reported. Signed-off-by: chidev <chicagowebdev@gmail.com>
The memory-core lint gate counted new raw allocator sites in the re-export commits (pass_calls.c 22 -> 28, pass_lsp_cross.c 49 -> 61). - The barrel walker now returns the graph node it reaches, borrowed for the life of the graph buffer, instead of a strdup'd QN. The import map stores that node's QN through the existing pxc_import_value_qn copy. - File and symbol lookups use cbm_pipeline_file_node and a stack-built symbol QN (cbm_pipeline_fqn_symbol_prefix_len), so they allocate nothing. - The visited-set keys are allocated and freed with cbm_alloc/cbm_free (CBM_MEM_CLASS_OTHER). - pass_calls keeps the JS/TS cross-file map as built and frees it with cbm_pxc_free_import_map, instead of copying it into a borrowed array. Both files are back at their baseline counts. Signed-off-by: chidev <chicagowebdev@gmail.com>
|
Thank you @chidev, both for this PR and for the way you built it. Carrying @antespi's two commits forward with his authorship and sign-off intact, crediting him in the description, and offering to step back if he wants to land them himself is exactly how we like to see work built on. The repro script with a decoy file makes a name guess visible at a glance. Keying the visited set on (file, name), with its own regression test, and failing closed when two different definitions are reachable are both the right instincts for this code. The dotted-basename fix for alias imports also matches what #1682 already does for relative imports, so that part fits in cleanly. A few things before this can land:
Fine to leave for a follow-up: Once these are in, we will run a before/after census of CALLS and IMPORTS on a real barrel-heavy TypeScript repository, through both the sequential and the parallel resolver. Thanks again, this closes a long-standing gap for NestJS and monorepo users. |
Calls through
index.tsre-exports now reach the function's defining file. This covers renamed named re-exports (export { a as b } from './m') andexport *chains, the cases in #2718 and #1557.Credit
The first two commits are @antespi's from #2402 (index.ts barrels, dotted file names). I kept his authorship and sign-off unchanged. On October 4 you asked for #2402 to be split into focused PRs. This PR is only the barrel part, plus one commit of mine for renames and
export *. @antespi, if you would rather land these yourself, I will close this PR. It only builds on your work.One claim
This PR changes only TS/JS re-export resolution. It does not include the bare-specifier binding reported in #2869, and it does not change MCP output.
Reproduction
repro.sh(below) writes 6 files: a renamed re-export, anexport *chain, and a decoy file with the same names. It uses its own cache and runtime folders.main (812d075):
this branch:
repro.sh
Tests
New cases in
tests/test_extraction_imports.candtests/test_lsp_resolution_probe.c. On macOS arm64:scripts/test.sh --suites extraction_imports,edge_imports,path_alias,mcp,lsp_resolution_probegives 625 passed, 4 skipped. The only failure in a wider run isregex_compile_refuses_overlong_pattern, which fails on main too (#2899).Every commit is signed off. I have not seen CI on Linux or Windows yet.