mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Merge pull request #3111 from benbria/master
Issue #3092: Fix column numbers in sourcemaps to not be essentially random.
This commit is contained in:
commit
9d24a3420d
2 changed files with 9 additions and 2 deletions
|
@ -69,7 +69,11 @@
|
|||
}
|
||||
newLines = helpers.count(fragment.code, "\n");
|
||||
currentLine += newLines;
|
||||
currentColumn = fragment.code.length - (newLines ? fragment.code.lastIndexOf("\n") : 0);
|
||||
if (newLines) {
|
||||
currentColumn = fragment.code.length - (fragment.code.lastIndexOf("\n") + 1);
|
||||
} else {
|
||||
currentColumn += fragment.code.length;
|
||||
}
|
||||
}
|
||||
js += fragment.code;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,10 @@ exports.compile = compile = withPrettyErrors (code, options) ->
|
|||
{noReplace: true})
|
||||
newLines = helpers.count fragment.code, "\n"
|
||||
currentLine += newLines
|
||||
currentColumn = fragment.code.length - (if newLines then fragment.code.lastIndexOf "\n" else 0)
|
||||
if newLines
|
||||
currentColumn = fragment.code.length - (fragment.code.lastIndexOf("\n") + 1)
|
||||
else
|
||||
currentColumn += fragment.code.length
|
||||
|
||||
# Copy the code from each fragment into the final JavaScript.
|
||||
js += fragment.code
|
||||
|
|
Loading…
Add table
Reference in a new issue