mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-30 01:43:36 +08:00
Prior to this change, SourceMap#reverseMapTextRange() would try to map a range in a source mapped entity by computing the closest points in the reverse mapping for the start and end position respectively. This does work for most cases, but does not properly support a lot of the more interesting cases. Most importantly it does not support the common case where source maps have "holes" for source entities, or map the same line of source code to multiple places in the generated code (inlining / tail duplication as done by JSCompiler for example). The previous method also did not properly support the case where an entry intersects with the range, but the start position of the source map entry lies before the range start position. This CL changes the method to return a sequence of text ranges, and addresses the more interesting cases. It also adds relevant test coverage. Bug: chromium:1409365 Change-Id: I40f268d1c7ea3c3284bf3f27d19578204ac821d9 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4196920 Commit-Queue: Simon Zünd <szuend@chromium.org> Reviewed-by: Simon Zünd <szuend@chromium.org> Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>