Skip to content

Return positions from every section in indexed allGeneratedPositionsFor - #565

Open
RaphaelFakhri wants to merge 1 commit into
mozilla:masterfrom
RaphaelFakhri:fix-indexed-all-generated-positions
Open

RaphaelFakhri wants to merge 1 commit into
mozilla:masterfrom
RaphaelFakhri:fix-indexed-all-generated-positions

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Summary

IndexedSourceMapConsumer.prototype.allGeneratedPositionsFor returns positions from the first section that contains the requested source only. When the same original source appears in several sections, positions in the later sections are missing.

This change queries every section that contains the source and concatenates the results in section order. The per-section offset handling moves unchanged into a private _sectionGeneratedPositionsFor helper. Each section keeps the existing lookup rules of BasicSourceMapConsumer.prototype.allGeneratedPositionsFor.

generatedPositionFor is unchanged, because it returns a single position.

Fixes #564

Testing

  • New test: test allGeneratedPositionsFor for index map with a source in several sections in test/test-source-map-consumer.js. It fails without the change in lib/source-map-consumer.js and passes with it.
  • npm test: 191 / 191 tests passed.
  • eslint and prettier --check . report no issues.

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 source maps: allGeneratedPositionsFor only returns positions from the first section that contains the source

1 participant