Skip to content

Fix column-span clipping for indexed maps with line offsets - #540

Open
NUAAwqy wants to merge 1 commit into
mozilla:masterfrom
NUAAwqy:taiyi/fix-indexed-column-spans
Open

NUAAwqy wants to merge 1 commit into
mozilla:masterfrom
NUAAwqy:taiyi/fix-indexed-column-spans

Conversation

@NUAAwqy

@NUAAwqy NUAAwqy commented Oct 13, 2026

Copy link
Copy Markdown

Indexed maps with a nonzero section line offset currently report an infinite column span where the following section starts on the same generated line. This can make a mapping's reported range include columns owned by the next section.

Apply the line offset before checking the next section's boundary in generatedPositionFor, allGeneratedPositionsFor, and eachMapping. Keep the first-line column-offset adjustment in section-local coordinates.

Add 12 regression and boundary tests covering all three APIs, both the first and later section lines, a next section on a different line, finite spans, and uncomputed terminal spans.

Closes #539

Validation (Node.js 22.22.0):

  • Original implementation: 9/12 new tests pass; one regression fails for each affected API.
  • Fixed implementation: 12/12 new tests and 202/202 full tests pass.
  • npm run coverage, repository-wide ESLint, and Prettier on the new test file pass.
  • The full suite uses the repository's pinned tc39/source-map-tests revision.

Implementation and test execution were assisted by Codex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Indexed column spans ignore section line offsets when clipping at the next section

1 participant