aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qmljs/qmljscheck.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/qmljs/qmljscheck.cpp')
-rw-r--r--src/libs/qmljs/qmljscheck.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp
index 65069cff59..f58b414487 100644
--- a/src/libs/qmljs/qmljscheck.cpp
+++ b/src/libs/qmljs/qmljscheck.cpp
@@ -34,7 +34,7 @@
#include <QColor>
#include <QDir>
-#include <QRegExp>
+#include <QRegularExpression>
using namespace QmlJS;
using namespace QmlJS::AST;
@@ -621,7 +621,6 @@ class UnsupportedTypesByQmlUi : public QStringList
public:
UnsupportedTypesByQmlUi() : QStringList({"ShaderEffect",
"Component",
- "Transition",
"Drawer"})
{
append(UnsupportedTypesByVisualDesigner());
@@ -907,7 +906,7 @@ static bool checkTopLevelBindingForParentReference(ExpressionStatement *expStmt,
SourceLocation location = locationFromRange(expStmt->firstSourceLocation(), expStmt->lastSourceLocation());
QString stmtSource = source.mid(int(location.begin()), int(location.length));
- if (stmtSource.contains(QRegExp("(^|\\W)parent\\.")))
+ if (stmtSource.contains(QRegularExpression("(^|\\W)parent\\.")))
return true;
return false;
@@ -942,6 +941,9 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
if (checkTypeForDesignerSupport(typeId))
addMessage(WarnUnsupportedTypeInVisualDesigner, typeErrorLocation, typeName);
+ if (QFileInfo(_doc->fileName()).baseName() == getRightMostIdentifier(typeId)->name.toString())
+ addMessage(ErrTypeIsInstantiatedRecursively, typeErrorLocation, typeName);
+
if (checkTypeForQmlUiSupport(typeId))
addMessage(ErrUnsupportedTypeInQmlUi, typeErrorLocation, typeName);
@@ -1559,7 +1561,7 @@ void Check::addMessage(StaticAnalysis::Type type, const SourceLocation &location
void Check::scanCommentsForAnnotations()
{
m_disabledMessageTypesByLine.clear();
- QRegExp disableCommentPattern(Message::suppressionPattern());
+ const QRegularExpression disableCommentPattern = Message::suppressionPattern();
foreach (const SourceLocation &commentLoc, _doc->engine()->comments()) {
const QString &comment = _doc->source().mid(int(commentLoc.begin()), int(commentLoc.length));
@@ -1572,14 +1574,15 @@ void Check::scanCommentsForAnnotations()
int lastOffset = -1;
QList<MessageTypeAndSuppression> disabledMessageTypes;
forever {
- lastOffset = disableCommentPattern.indexIn(comment, lastOffset + 1);
- if (lastOffset == -1)
+ const QRegularExpressionMatch match = disableCommentPattern.match(comment, lastOffset + 1);
+ if (!match.hasMatch())
break;
+ lastOffset = match.capturedStart();
MessageTypeAndSuppression entry;
- entry.type = static_cast<StaticAnalysis::Type>(disableCommentPattern.cap(1).toInt());
+ entry.type = static_cast<StaticAnalysis::Type>(match.captured(1).toInt());
entry.wasSuppressed = false;
entry.suppressionSource = SourceLocation(commentLoc.offset + quint32(lastOffset),
- quint32(disableCommentPattern.matchedLength()),
+ quint32(match.capturedLength()),
commentLoc.startLine,
commentLoc.startColumn + quint32(lastOffset));
disabledMessageTypes += entry;