Issue #3092: Fix column numbers in sourcemaps to not be essentially random.

This commit is contained in:
Jason Walton 2013-08-06 16:25:23 -04:00
parent 15517df417
commit 3ad332d5d4
2 changed files with 9 additions and 2 deletions

View File

@ -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;
}

View File

@ -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