Merge pull request #3966 from davidbau/simplesourcemaps

Fix #3965, sourcemaps for bare programs.
This commit is contained in:
Michael Ficarra 2015-05-08 07:52:58 -07:00
commit c0d44b1abd
1 changed files with 2 additions and 1 deletions

View File

@ -63,7 +63,8 @@ exports.compile = compile = withPrettyErrors (code, options) ->
for fragment in fragments
# Update the sourcemap with data from each fragment
if options.sourceMap
if fragment.locationData
# Do not include empty, whitespace, or semicolon-only fragments.
if fragment.locationData and not /^[;\s]*$/.test fragment.code
map.add(
[fragment.locationData.first_line, fragment.locationData.first_column]
[currentLine, currentColumn]