-
Notifications
You must be signed in to change notification settings - Fork 361
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
Only generate a mapping at a generated location for the most specific mapping #61
Comments
@mishoo, @michaelficarra opinions? |
I saw this question when it was first posed in the PR. It's a tough call, but it seems like a good strategy to use the most specific mapping. |
I think it makes no sense to map a generated location to multiple things... I vote for keeping only the most specific mapping. Here is another problem: map.addMapping({
generated: { line: 3, column: 5 },
original: { line: 6, column: 7 },
source: 'foo.js',
name: 'bar'
});
map.addMapping({
generated: { line: 3, column: 5 },
original: { line: 8, column: 9 },
source: 'bar.js',
name: 'foo'
}); Keep both, keep only one, or throw an exception? |
Exception! |
Yeah that was what I was getting at it with my blurb below the code example. I think it makes sense to only keep the most specific mapping, if each mapping just adds more info and doesn't contradict previous mappings. In the case of contradictions, I think we need to throw an exception. |
Sounds good to me. |
This might be a pathological case, but I thought I'd throw it out there for consideration.
To fully describe what the token Maybe less pathological: generated lookup tables and generated constants. Most of the time, you don't want to jump to the generation code every time you debug, but occasionally you might want to. Again, kind of a specialized use case. But as long as the underlying sourcemap format continues to support multiple locations, I don't think there's any reason to complicate |
Since there's been multiple releases with the current behavior, I'll assume that this question is effectively answered. |
Re-opening since the issue seems to come up in other reports like #242. |
If we have the following mappings, should we generate them all in the source map or only the most specific mapping?
What should be the behavior if there is different original locations for the same generated position? Should we still use the most specific/detailed mapping and ignore the others?
The text was updated successfully, but these errors were encountered: