forked from qt-creator/qt-creator
QmlJS: Fix compile
..in general, with tests, and when using a namespaced Qt.
Amends b09a48599e.
Change-Id: I99e275e10df5eed741d021911a360457f0d0d2e7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
@@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
#include "qmljssourcelocation_p.h"
|
#include "qmljssourcelocation_p.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_QML_BEGIN_NAMESPACE
|
||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
class DiagnosticMessage
|
class DiagnosticMessage
|
||||||
@@ -93,7 +93,8 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace QmlJS
|
} // namespace QmlJS
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
Q_DECLARE_TYPEINFO(QmlJS::DiagnosticMessage, Q_MOVABLE_TYPE);
|
Q_DECLARE_TYPEINFO(QmlJS::DiagnosticMessage, Q_MOVABLE_TYPE);
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
QT_QML_END_NAMESPACE
|
||||||
|
|||||||
@@ -36,8 +36,9 @@
|
|||||||
#include <QtCore/QScopedValueRollback>
|
#include <QtCore/QScopedValueRollback>
|
||||||
|
|
||||||
QT_QML_BEGIN_NAMESPACE
|
QT_QML_BEGIN_NAMESPACE
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok);
|
Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok);
|
||||||
QT_QML_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
|
|
||||||
@@ -1619,3 +1620,5 @@ bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QT_QML_END_NAMESPACE
|
||||||
|
|||||||
@@ -587,9 +587,9 @@ protected:
|
|||||||
accept(ast->importUri);
|
accept(ast->importUri);
|
||||||
if (ast->version) {
|
if (ast->version) {
|
||||||
out(" ");
|
out(" ");
|
||||||
out(QString::number(ast->version->majorVersion).toUtf8());
|
out(QString::number(ast->version->majorVersion));
|
||||||
out(".");
|
out(".");
|
||||||
out(QString::number(ast->version->minorVersion).toUtf8());
|
out(QString::number(ast->version->minorVersion));
|
||||||
}
|
}
|
||||||
if (!ast->importId.isNull()) {
|
if (!ast->importId.isNull()) {
|
||||||
out(" as ", ast->asToken);
|
out(" as ", ast->asToken);
|
||||||
|
|||||||
@@ -773,7 +773,7 @@ void TextToModelMerger::setupImports(const Document::Ptr &doc,
|
|||||||
|
|
||||||
QString version;
|
QString version;
|
||||||
if (import->version != nullptr)
|
if (import->version != nullptr)
|
||||||
version = QLatin1String("%1.%2").arg(import->version->majorVersion).arg(import->version->minorVersion);
|
version = QString("%1.%2").arg(import->version->majorVersion).arg(import->version->minorVersion);
|
||||||
const QString &as = import->importId.toString();
|
const QString &as = import->importId.toString();
|
||||||
|
|
||||||
if (!import->fileName.isEmpty()) {
|
if (!import->fileName.isEmpty()) {
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ void tst_Check::test()
|
|||||||
const QRegExp messagePattern(" (\\d+) (\\d+) (\\d+)");
|
const QRegExp messagePattern(" (\\d+) (\\d+) (\\d+)");
|
||||||
|
|
||||||
QList<Message> expectedMessages;
|
QList<Message> expectedMessages;
|
||||||
foreach (const AST::SourceLocation &comment, doc->engine()->comments()) {
|
foreach (const SourceLocation &comment, doc->engine()->comments()) {
|
||||||
const QString text = doc->source().mid(comment.begin(), comment.end() - comment.begin());
|
const QString text = doc->source().mid(comment.begin(), comment.end() - comment.begin());
|
||||||
|
|
||||||
if (messagePattern.indexIn(text) == -1)
|
if (messagePattern.indexIn(text) == -1)
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ protected: // visiting functions:
|
|||||||
else
|
else
|
||||||
terminal(ast->fileNameToken);
|
terminal(ast->fileNameToken);
|
||||||
|
|
||||||
terminal(ast->versionToken);
|
terminal(ast->version->firstSourceLocation());
|
||||||
terminal(ast->asToken);
|
terminal(ast->asToken);
|
||||||
terminal(ast->importIdToken);
|
terminal(ast->importIdToken);
|
||||||
terminal(ast->semicolonToken);
|
terminal(ast->semicolonToken);
|
||||||
@@ -299,6 +299,9 @@ protected: // visiting functions:
|
|||||||
virtual bool visit(DebuggerStatement *ast) { terminal(ast->debuggerToken); terminal(ast->semicolonToken); return false; }
|
virtual bool visit(DebuggerStatement *ast) { terminal(ast->debuggerToken); terminal(ast->semicolonToken); return false; }
|
||||||
virtual bool visit(UiParameterList *ast) { terminal(ast->commaToken); terminal(ast->identifierToken); nonterminal(ast->next); return false; }
|
virtual bool visit(UiParameterList *ast) { terminal(ast->commaToken); terminal(ast->identifierToken); nonterminal(ast->next); return false; }
|
||||||
|
|
||||||
|
void throwRecursionDepthError() override {
|
||||||
|
qWarning() << "Reached maximum recursion depth.";
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
QHash<Node *, QByteArray> _id;
|
QHash<Node *, QByteArray> _id;
|
||||||
QList<QPair<QByteArray, QByteArray> > _connections;
|
QList<QPair<QByteArray, QByteArray> > _connections;
|
||||||
|
|||||||
Reference in New Issue
Block a user