diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2020-02-28 13:57:16 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2020-03-02 11:02:35 +0100 |
commit | 281a2dc91e96ffc833f85faf05c73eddc5bac645 (patch) | |
tree | ce88cb69bdc68072e9b4375f12cf62577cbcb89e /src/linguist | |
parent | faf3ced146b50e3eb8b20a3d02711c29f9484106 (diff) |
Prepare for internal QML Parser API change
With the internal API version 8, the SourceLocation will move from
QQmlJS::AST to the QQmlJS namespace, and it will get its
loc.startLine/loc.startColumn members back.
Change-Id: I70ba5a7f7b6eca60298a7b4982bf2cf099110089
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/linguist')
-rw-r--r-- | src/linguist/lupdate/qdeclarative.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/linguist/lupdate/qdeclarative.cpp b/src/linguist/lupdate/qdeclarative.cpp index 7a453aa32..7d995ae86 100644 --- a/src/linguist/lupdate/qdeclarative.cpp +++ b/src/linguist/lupdate/qdeclarative.cpp @@ -39,6 +39,7 @@ #include <private/qqmljslexer_p.h> #include <private/qqmljsastvisitor_p.h> #include <private/qqmljsast_p.h> +#include <private/qqmlapiversion_p.h> #include <QCoreApplication> #include <QFile> @@ -52,6 +53,12 @@ QT_BEGIN_NAMESPACE +#if Q_QML_PRIVATE_API_VERSION < 8 +namespace QQmlJS { + using SourceLocation = AST::SourceLocation; +} +#endif + using namespace QQmlJS; static QString MagicComment(QLatin1String("TRANSLATOR")); @@ -229,7 +236,7 @@ private: void processComments(quint32 offset, bool flush = false); - void processComment(const AST::SourceLocation &loc); + void processComment(const SourceLocation &loc); void consumeComment(); bool createString(AST::ExpressionNode *ast, QString *out) @@ -259,7 +266,7 @@ private: TranslatorMessage::ExtraData extra; QString sourcetext; QString trcontext; - QList<AST::SourceLocation> m_todo; + QList<SourceLocation> m_todo; }; QString createErrorString(const QString &filename, const QString &code, Parser &parser) @@ -274,7 +281,7 @@ QString createErrorString(const QString &filename, const QString &code, Parser & if (m.isWarning()) continue; -#if Q_QML_PRIVATE_API_VERSION < 5 +#if Q_QML_PRIVATE_API_VERSION >= 8 const int line = m.loc.startLine; const int column = m.loc.startColumn; #else @@ -315,7 +322,7 @@ void FindTrCalls::postVisit(AST::Node *node) void FindTrCalls::processComments(quint32 offset, bool flush) { for (; !m_todo.isEmpty(); m_todo.removeFirst()) { - AST::SourceLocation loc = m_todo.first(); + SourceLocation loc = m_todo.first(); if (! flush && (loc.begin() >= offset)) break; @@ -332,7 +339,7 @@ void FindTrCalls::consumeComment() sourcetext.clear(); } -void FindTrCalls::processComment(const AST::SourceLocation &loc) +void FindTrCalls::processComment(const SourceLocation &loc) { if (!loc.length) return; |