diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-06-24 15:44:07 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-06-24 15:52:22 +0200 |
commit | 875a927b49b241e6a96f2c8aace8a9c69da04ce7 (patch) | |
tree | 684df96676aa68c9725476f8c02ecc74c04742e3 | |
parent | b9b2b6af850a94f2385e137fd4bb54b9b429f8c8 (diff) | |
download | qttools-875a927b49b241e6a96f2c8aace8a9c69da04ce7.tar.gz |
Adapt to new signature for QQmlJS::DiagnosticMessage
Change-Id: I6282b4ba75fbb5f5c763044b29ed2f6cf2eaffd6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | src/linguist/lupdate/qdeclarative.cpp | 31 | ||||
-rw-r--r-- | src/qdoc/qmlcodeparser.cpp | 11 |
2 files changed, 21 insertions, 21 deletions
diff --git a/src/linguist/lupdate/qdeclarative.cpp b/src/linguist/lupdate/qdeclarative.cpp index fa8ad260e..ddf7d2f35 100644 --- a/src/linguist/lupdate/qdeclarative.cpp +++ b/src/linguist/lupdate/qdeclarative.cpp @@ -274,25 +274,20 @@ QString createErrorString(const QString &filename, const QString &code, Parser & if (m.isWarning()) continue; - QString error = filename + QLatin1Char(':') + QString::number(m.loc.startLine) - + QLatin1Char(':') + QString::number(m.loc.startColumn) + QLatin1String(": error: ") - + m.message + QLatin1Char('\n'); - - int line = 0; - if (m.loc.startLine > 0) - line = m.loc.startLine - 1; - - const QString textLine = lines.at(line); - +#if Q_QML_PRIVATE_API_VERSION < 5 + const int line = m.loc.startLine; + const int column = m.loc.startColumn; +#else + const int line = m.line; + const int column = m.column; +#endif + QString error = filename + QLatin1Char(':') + + QString::number(line) + QLatin1Char(':') + QString::number(column) + + QLatin1String(": error: ") + m.message + QLatin1Char('\n'); + + const QString textLine = lines.at(line > 0 ? line - 1 : 0); error += textLine + QLatin1Char('\n'); - - int column = m.loc.startColumn - 1; - if (column < 0) - column = 0; - - column = qMin(column, textLine.length()); - - for (int i = 0; i < column; ++i) { + for (int i = 0, end = qMin(column > 0 ? column - 1 : 0, textLine.length()); i < end; ++i) { const QChar ch = textLine.at(i); if (ch.isSpace()) error += ch.unicode(); diff --git a/src/qdoc/qmlcodeparser.cpp b/src/qdoc/qmlcodeparser.cpp index 437bcfd21..5539d5b80 100644 --- a/src/qdoc/qmlcodeparser.cpp +++ b/src/qdoc/qmlcodeparser.cpp @@ -147,9 +147,14 @@ void QmlCodeParser::parseSourceFile(const Location& location, const QString& fil << "The output is incomplete."; } } - foreach (const QQmlJS::DiagnosticMessage &msg, parser->diagnosticMessages()) { - qDebug().nospace() << qPrintable(filePath) << ':' << msg.loc.startLine - << ": QML syntax error at col " << msg.loc.startColumn + foreach (const QQmlJS::DiagnosticMessage &msg, parser->diagnosticMessages()) { + qDebug().nospace() << qPrintable(filePath) << ':' +#if Q_QML_PRIVATE_API_VERSION < 5 + << msg.loc.startLine << ": QML syntax error at col " + << msg.loc.startColumn +#else + << msg.line << ": QML syntax error at col " << msg.column +#endif << ": " << qPrintable(msg.message); } currentFile_.clear(); |