fix(extraction): a Svelte or Astro markup call on an arrow parameter no longer links to a same-named import
In Svelte and Astro markup, {rows.map((count) => count.set(1))} no longer links count.set to a script import named count.
Markup has no binding rows, so the script's import was the only binding the resolver saw for the name, and a call on the arrow's own parameter linked to it. Since #523 made member calls on imported constants link, this showed up as a wrong calls edge to the constant; it also happened for an imported function called by an arrow parameter of the same name. The Svelte block-local guard from #523 covered {#each}, {#snippet}, {#await} and {@const} only.
arrowParamNames (in sfc-script.ts, shared by both extractors) reads the parameter names of the arrow functions in one markup expression ((a, b) =>, a =>, ({ a }) =>), and the template scan skips a call rooted at one of them. A call on a name the arrow does not declare still links.
Scope: parameters declared and used in the same {…} group. An Astro {posts.map((post) => ( that opens on one line and uses the parameter in a call on a later line is not covered.
Verification (head 24bb0186):
- New
__tests__/markup-arrow-parameter-calls.test.ts: five arrow shapes in Svelte and five in Astro, plus a control that still links. It fails on the base commit (both tests) and passes with the change. - Full suite: 752 files, 9,296 passed, 40 skipped. Kernel golden dumps unchanged.
tsc --noEmitclean. - No resolver change, so the precision corpora were not run.
README rows checked: the Svelte and Astro rows in the language table and the "About this fork" tables; none quotes this behavior, so no README change. CHANGELOG entry added under Fixes. Does not promote the deployed build.
Summary by cubic
In Svelte and Astro markup, a call on a name an arrow function declares as a parameter ({rows.map((count) => count.set(1))}) no longer links to a script import of the same name. Markup has no binding rows, so the script import was the only binding the resolver saw, and the call produced a wrong calls edge to it.
- Adds
arrowScopesinsfc-script.ts, shared by both extractors; it reads balanced parameter lists ((count) =>,count =>,({ count }) =>,(count = …) =>,async (count) =>) and ignores arrow-like text inside quotes and comments. - The template scan skips a call rooted at a parameter name only inside that arrow's body; a call on a name the arrow does not declare, or outside its body, still links.
- Covers only parameters in the same
{…}expression, so an Astro arrow that opens on one line and is used on a later line is not covered. - Adds
__tests__/markup-arrow-parameter-calls.test.tscovering seven arrow shapes per language plus controls that still link, and a CHANGELOG entry; re-index Svelte and Astro projects after upgrading.