fixes #2521: line numbers in errors affected by newlines in backticks

This commit is contained in:
Michael Ficarra 2012-08-29 12:54:50 -05:00
parent ba34f8d389
commit 1b14c035e7
2 changed files with 2 additions and 0 deletions

View File

@ -217,6 +217,7 @@
return 0;
}
this.token('JS', (script = match[0]).slice(1, -1));
this.line += count(script, '\n');
return script.length;
};

View File

@ -197,6 +197,7 @@ exports.Lexer = class Lexer
jsToken: ->
return 0 unless @chunk.charAt(0) is '`' and match = JSTOKEN.exec @chunk
@token 'JS', (script = match[0])[1...-1]
@line += count script, '\n'
script.length
# Matches regular expression literals. Lexing regular expressions is difficult