Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a decoding algorithm for index maps #132

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

takikawa
Copy link
Collaborator

@takikawa takikawa commented Sep 27, 2024

Rendered draft

This PR adds a decoding algorithm for index maps along the lines of the existing algorithms for normal source maps.

I'll leave a few comments for cases in the spec where it's not clear what we should do:

  • Error cases for offsets
  • The check for index map overlap

source-map.bs Outdated Show resolved Hide resolved
source-map.bs Outdated
1. If |offsetColumn| is not a number, [=optionally report an error=].
1. If |previousOffset| is not null,
1. If |previousLastMapping| is not null,
1. If |offsetLine| is less than |previousLastMapping|'s [=decoded mapping/generatedLine=], [=optionally report an error=].
Copy link
Collaborator Author

@takikawa takikawa Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these range checks be "less than or equal to" to be strict inequality rather than allowing equality?

source-map.bs Outdated Show resolved Hide resolved
source-map.bs Outdated Show resolved Hide resolved
source-map.bs Outdated Show resolved Hide resolved
source-map.bs Outdated Show resolved Hide resolved
source-map.bs Show resolved Hide resolved
@takikawa takikawa changed the title Draft: Add a decoding algorithm for index maps Add a decoding algorithm for index maps Nov 8, 2024
These aren't linked to so they don't need the tags
source-map.bs Outdated Show resolved Hide resolved
source-map.bs Outdated Show resolved Hide resolved
source-map.bs Show resolved Hide resolved
  * Fix first line issue
  * Use extend again for new mappings
  * Check the overlap of ranges {lastFirst, lastPrev} and the
    {first, last} of the current source map section instead of
    current more complicated steps.
  * The overlap check also ensures the order of the ranges, beyond
    the ordering of the offsets (which itself doesn't guarantee
    range order)
  * Some editorial changes for the check
Also set a default value so the algorithm continues
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.

3 participants