From:  Brian Slesinsky <skybrian@google.com>
Date:  03 Feb 2015 06:16:59 Hong Kong Time
Newsgroup:  news.mozilla.org/mozilla.dev.js-sourcemap
Subject:  

Re: Source Maps, Debuggers, and Generated Code

NNTP-Posting-Host:  63.245.216.66

On Mon, Feb 2, 2015 at 1:14 PM, Nick Fitzgerald 
wrote:
>
> ‚ÄčI think there are two cases here:
>
> 1. When the compiler needs to embed a runtime with various helper functions
> in the generated JS code. In this case, I think it makes sense to add an
> entry to the sources list and map the appropriate code to this runtime
> source.
>
> 2. When a single statement in the source language results in many
> statements in the JS code. In this case, I believe that all the generated
> statements in the JS code should map back to the same location in the
> source language.


One problem is that JavaScript code may be reused (for example, it could be
a generic helper function called from many places). But a sourcemap can
only map it to one source location. You could get around this by generating
the code N times for N locations, but this creates code bloat similar to
inlining.

- Brian