forked from qt-creator/qt-creator
QmlJSCheck: Add Error message for recursively instantiated type
Change-Id: I68b46a929c65fb21ee8473cda44f7de4e40009c7 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -942,6 +942,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);
|
||||
|
||||
|
@@ -245,6 +245,8 @@ StaticAnalysisMessages::StaticAnalysisMessages()
|
||||
tr("Duplicate import (%1)."), 1);
|
||||
newMsg(ErrHitMaximumRecursion, Error,
|
||||
tr("Hit maximum recursion limit when visiting AST."));
|
||||
newMsg(ErrTypeIsInstantiatedRecursively, Error,
|
||||
tr("Type cannot be instantiated recursively (%1)."), 1);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
@@ -89,6 +89,7 @@ enum Type
|
||||
MaybeWarnEqualityTypeCoercion = 126,
|
||||
WarnConfusingExpressionStatement = 127,
|
||||
StateCannotHaveChildItem = 128,
|
||||
ErrTypeIsInstantiatedRecursively = 129,
|
||||
HintDeclarationsShouldBeAtStartOfFunction = 201,
|
||||
HintOneStatementPerLine = 202,
|
||||
WarnImperativeCodeNotEditableInVisualDesigner = 203,
|
||||
|
Reference in New Issue
Block a user