QmlJS: Update QML parser using the one from qtdeclarative 5.15

We need to do this because the new "required" keyword should be
recognized by Qt Creator.

This is not a verbatim copy of the QML parser from qtdeclarative. A few
data structures have changed that would require large scale changes in
otherwise unrelated parts of the code. For example, all Visitors need to
handle recursion depth errors now and the DiagnosticMessage only has
line and column now, no longer begin and legth.

Change-Id: Iea5b04e27b07e0cba55d64b844315af9828acbf7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Ulf Hermann
2019-10-04 16:11:02 +02:00
parent 979d14525c
commit 58d35f8a64
14 changed files with 4344 additions and 3513 deletions

View File

@@ -66,7 +66,7 @@ public:
return _message;
}
void setMessage(Type type)
void setMessage(StaticAnalysis::Type type)
{
_message = Message(type, _location);
}
@@ -511,7 +511,7 @@ protected:
}
private:
void addMessage(Type type, const SourceLocation &loc, const QString &arg1 = QString())
void addMessage(StaticAnalysis::Type type, const SourceLocation &loc, const QString &arg1 = QString())
{
_messages.append(Message(type, loc, arg1));
}
@@ -695,12 +695,12 @@ QList<Message> Check::operator()()
return _messages;
}
void Check::enableMessage(Type type)
void Check::enableMessage(StaticAnalysis::Type type)
{
_enabledMessages.insert(type);
}
void Check::disableMessage(Type type)
void Check::disableMessage(StaticAnalysis::Type type)
{
_enabledMessages.remove(type);
}
@@ -1267,7 +1267,7 @@ bool Check::visit(BinaryExpression *ast)
const QLatin1Char newline('\n');
if (ast->op == QSOperator::Add || ast->op == QSOperator::Sub) {
QChar match;
Type msg;
StaticAnalysis::Type msg;
if (ast->op == QSOperator::Add) {
match = '+';
msg = WarnConfusingPluses;
@@ -1522,7 +1522,7 @@ void Check::addMessage(const Message &message)
}
}
void Check::addMessage(Type type, const SourceLocation &location, const QString &arg1, const QString &arg2)
void Check::addMessage(StaticAnalysis::Type type, const SourceLocation &location, const QString &arg1, const QString &arg2)
{
addMessage(Message(type, location, arg1, arg2));
}