diff options
author | Thomas Hartmann <Thomas.Hartmann@digia.com> | 2014-10-15 12:32:26 +0200 |
---|---|---|
committer | Thomas Hartmann <Thomas.Hartmann@digia.com> | 2014-10-15 12:37:28 +0200 |
commit | 79561071877e8156edab137301ee051681cb1a0a (patch) | |
tree | 0b4a5eb976565c42ea6a9baea3299fca4a5014b3 /src/libs/qmljs/qmljscheck.cpp | |
parent | eacaf93a594e8f4491bf69e7b95a8ffada66034f (diff) | |
download | qt-creator-79561071877e8156edab137301ee051681cb1a0a.tar.gz |
QmlJS: Distinguish between erros for ui.qml files and designer warnings
We properly distinguish between warnings in the Qt Quick Designer and
error in a .ui.qml file.
The warnings are a subset of the errors anyway.
Change-Id: Ib3b21a845436381df10863b464c975b0b39fc063
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Diffstat (limited to 'src/libs/qmljs/qmljscheck.cpp')
-rw-r--r-- | src/libs/qmljs/qmljscheck.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index 9102aa9216..9083952305 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -599,7 +599,7 @@ Check::Check(Document::Ptr doc, const ContextPtr &context) disableMessage(HintExtraParentheses); if (isQtQuick2Ui()) { - enableQmlDesignerChecks(); + disableQmlDesignerChecks(); } else { disableQmlDesignerChecks(); disableQmlDesignerUiFileChecks(); @@ -633,12 +633,11 @@ void Check::disableMessage(Type type) void Check::enableQmlDesignerChecks() { - enableMessage(StaticAnalysis::WarnImperativeCodeNotEditableInVisualDesigner); - enableMessage(StaticAnalysis::WarnUnsupportedTypeInVisualDesigner); - enableMessage(StaticAnalysis::WarnReferenceToParentItemNotSupportedByVisualDesigner); - enableMessage(StaticAnalysis::WarnReferenceToParentItemNotSupportedByVisualDesigner); - enableMessage(StaticAnalysis::WarnAboutQtQuick1InsteadQtQuick2); - enableMessage(StaticAnalysis::ErrUnsupportedRootTypeInVisualDesigner); + enableMessage(WarnImperativeCodeNotEditableInVisualDesigner); + enableMessage(WarnUnsupportedTypeInVisualDesigner); + enableMessage(WarnReferenceToParentItemNotSupportedByVisualDesigner); + enableMessage(WarnAboutQtQuick1InsteadQtQuick2); + enableMessage(ErrUnsupportedRootTypeInVisualDesigner); //## triggers too often ## check.enableMessage(StaticAnalysis::WarnUndefinedValueForVisualDesigner); } @@ -659,6 +658,8 @@ void Check::enableQmlDesignerUiFileChecks() enableMessage(ErrFunctionsNotSupportedInQmlUi); enableMessage(ErrBlocksNotSupportedInQmlUi); enableMessage(ErrBehavioursNotSupportedInQmlUi); + enableMessage(ErrStatesOnlyInRootItemInQmlUi); + enableMessage(ErrReferenceToParentItemNotSupportedInQmlUi); } void Check::disableQmlDesignerUiFileChecks() @@ -668,6 +669,8 @@ void Check::disableQmlDesignerUiFileChecks() disableMessage(ErrFunctionsNotSupportedInQmlUi); disableMessage(ErrBlocksNotSupportedInQmlUi); disableMessage(ErrBehavioursNotSupportedInQmlUi); + disableMessage(ErrStatesOnlyInRootItemInQmlUi); + disableMessage(ErrReferenceToParentItemNotSupportedInQmlUi); } bool Check::preVisit(Node *ast) @@ -823,8 +826,10 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId, if (checkTypeForQmlUiSupport(typeId)) addMessage(ErrUnsupportedTypeInQmlUi, typeErrorLocation, typeName); - if (m_typeStack.count() > 1 && getRightMostIdentifier(typeId)->name.toString() == QLatin1String("State")) + if (m_typeStack.count() > 1 && getRightMostIdentifier(typeId)->name.toString() == QLatin1String("State")) { addMessage(WarnStatesOnlyInRootItemForVisualDesigner, typeErrorLocation); + addMessage(ErrStatesOnlyInRootItemInQmlUi, typeErrorLocation); + } if (m_typeStack.isEmpty() && unsupportedRootObjectTypesByVisualDesigner()->contains(typeName)) @@ -929,6 +934,8 @@ bool Check::visit(UiScriptBinding *ast) && checkTopLevelBindingForParentReference(cast<ExpressionStatement *>(ast->statement), _doc->source())) { addMessage(WarnReferenceToParentItemNotSupportedByVisualDesigner, locationFromRange(ast->firstSourceLocation(), ast->lastSourceLocation())); + addMessage(ErrReferenceToParentItemNotSupportedInQmlUi, + locationFromRange(ast->firstSourceLocation(), ast->lastSourceLocation())); } checkProperty(ast->qualifiedId); |