Skip to content

fix: Tokens only extend to the end of the line #131

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

Closed
wants to merge 1 commit into from

Conversation

loewenheim
Copy link
Contributor

Previously, when looking up a line and column, we would always return the token at or immediately before that position, even if it belonged to an earlier minified line. This is

  1. wrong—tokens are only meant to extend to the end of a line.
  2. inconsistent—this means that an unmapped line before any mapped line would return no mapping, but an unmapped line after a mapped line would.

loewenheim added a commit to getsentry/symbolic that referenced this pull request Aug 8, 2025
This is the `sourcemapcache` equivalent of
getsentry/rust-sourcemap#131 (but does not
depend on it).

Previously, when looking up a line and column, we would always return
the token at or immediately before that position, even if it belonged to
an earlier minified line. This is

1. wrong—tokens are only meant to extend to the end of a line.
2. inconsistent—this means that an unmapped line before any mapped line
   would return no mapping, but an unmapped line after a mapped line
   would.
loewenheim added a commit to getsentry/symbolic that referenced this pull request Aug 8, 2025
This is the `sourcemapcache` equivalent of
getsentry/rust-sourcemap#131 (but does not
depend on it).

Previously, when looking up a line and column, we would always return
the token at or immediately before that position, even if it belonged to
an earlier minified line. This is

1. wrong—tokens are only meant to extend to the end of a line.
2. inconsistent—this means that an unmapped line before any mapped line
   would return no mapping, but an unmapped line after a mapped line
   would.
@loewenheim loewenheim requested a review from a team August 8, 2025 15:20
Previously, when looking up a line and column, we would always return
the token at or immediately before that position, even if it belonged
to an earlier minified line. This is
1. wrong—tokens are only meant to extend to the end of a line.
2. inconsistent—this means that an unmapped line before any mapped line
   would return no mapping, but an unmapped line after a mapped line
   would.
@loewenheim loewenheim force-pushed the sebastian/token-line branch from cf78d4b to 741f3f6 Compare August 8, 2025 16:49
@loewenheim
Copy link
Contributor Author

Actually, the lookup_token method is used internally and it's expected that it returns the last token before the lookup position, even if it's on a different line. As such I'm closing this.

@loewenheim loewenheim closed this Aug 8, 2025
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.

1 participant