-
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
Ignore duplicate mappings #60
Conversation
This code works under the assumption that the same generated location should never map to multiple source locations or names.
? mappingA.generated.column - mappingB.generated.column | ||
: cmp; | ||
return cmpLocation(mappingA.generated, mappingB.generated) || | ||
cmpLocation(mappingA.original, mappingB.original) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This throws if original
is null
.
Here is a test sokra@de77eb1
Thanks for the |
Question: are these considered duplicate mappings?
|
I don't have time to do an in depth review right now, but at first glance this looks pretty good. Two comments now:
I would say technically no, and handling that is outside of the scope of this pull request. However it is worth discussing this, so I have created an issue where both of your opinions are very welcome: #61 |
I'm glad I don't have to do the fuzzy matching from my question previously. It makes things much simpler. I'm putting together a less fiddly test right now, but I thought I'd push all the non-test commits first.
It was three things.
In short, doh! Fixed in usrbincc/source-map@e834365 |
Thanks! |
Two implementations.
I personally prefer the simpler implementation, if you can rely upon the mentioned invariant. But then again, who knows what kind of crazy corner cases may show up in the wild.
Or should differing mappings with identical generated locations be errors?
I tried to follow the prevailing coding style, but I couldn't resist giving
strcmp
its rightful name.This should fix #21, assuming the added test is sufficient.