forked from qt-creator/qt-creator
QmlJS: Fix line number for string literals (Part 2)
Amends 626807c94e. Scanning the strings appears differently if
using multi-line strings and using the line terminator at the beginning
of a string or having already some characters present.
Fixes: QTCREATORBUG-23777
Change-Id: I840a11e3b0e06adda443849f926189bda9dc2e4b
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
This commit is contained in:
@@ -877,12 +877,13 @@ int Lexer::scanString(ScanStringMode mode)
|
||||
// in case we just parsed a \r, we need to reset this flag to get things working
|
||||
// correctly in the loop below and afterwards
|
||||
_skipLinefeed = false;
|
||||
|
||||
bool first = true;
|
||||
if (_engine) {
|
||||
while (_codePtr <= _endPtr) {
|
||||
if (isLineTerminator()) {
|
||||
if ((quote == QLatin1Char('`') || qmlMode())) {
|
||||
--_currentLineNumber;
|
||||
if (first)
|
||||
--_currentLineNumber;
|
||||
break;
|
||||
}
|
||||
_errorCode = IllegalCharacter;
|
||||
@@ -910,6 +911,7 @@ int Lexer::scanString(ScanStringMode mode)
|
||||
// don't use scanChar() here, that would transform \r sequences and the midRef() call would create the wrong result
|
||||
_char = *_codePtr++;
|
||||
++_currentColumnNumber;
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user