3 ms·
It's many to one, actually. Each range of JavaScript has to be generated by only one line of source, but in the other direction there's no constraint. So a sing
by skybrian 13y ago
It's many to one, actually. Each range of JavaScript has to be generated by only one line of source, but in the other direction there's no constraint. So a single position in source could map to multiple character locations in JavaScript (for example, due to inlining).
However, I don't believe browser debuggers handle this properly yet.
The way to understand the spec is that they wanted to enable breakpoints. Breakpoints in debuggers such as Chrome are line-oriented. If the debugger can find the corresponding position in JavaScript and set a breakpoint, the sourcemap did its job.
However, there are other issues with sourcemapped breakpoints:
https://code.google.com/p/chromium/issues/detail?id=333569 https://code.google.com/p/chromium/issues/detail?id=333569