aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser/qqmljslexer.cpp
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2020-06-10 21:11:52 +0200
committerChristian Stenger <christian.stenger@qt.io>2020-06-12 07:57:42 +0200
commit0be8c5ae21968978ebd8e75eed10b765e002f166 (patch)
tree8f911e26bfddaffc2a9fe8c60702caf098e7bbff /src/qml/parser/qqmljslexer.cpp
parentd373fcab7a2beac1addc04a6bbe0b4d1f9770f23 (diff)
Fix lexer line number if code contains continuation strings
Follow-up lines of continuations strings that directly end with an unescaped line feed still broke the line numbers of code following the string. Fix by explicitly handling the first character inside a string differently. Amends 126ee5c901a9675a9ab61d4c6f2961c95b8bceac. Change-Id: Ia945546d35db844114064ae34d6189704ceefe3b Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljslexer.cpp')
-rw-r--r--src/qml/parser/qqmljslexer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/parser/qqmljslexer.cpp b/src/qml/parser/qqmljslexer.cpp
index f1f6a68583..cdab17ff63 100644
--- a/src/qml/parser/qqmljslexer.cpp
+++ b/src/qml/parser/qqmljslexer.cpp
@@ -889,12 +889,14 @@ 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 == u'`' || qmlMode())) {
- --_currentLineNumber; // will be read again in scanChar()
+ if (first)
+ --_currentLineNumber; // will be read again in scanChar()
break;
}
_errorCode = IllegalCharacter;
@@ -922,6 +924,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;
}
}