QmlJS: Add error message for Component with multiple children

Component is only allowed to have a single child element, that will
be the root element of the component.

If there is no child at all we create a warning. Having no child is
temporarily required.

Change-Id: I5c0d9d9cdf1be106b20ed4f1134a973d58126498
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Thomas Hartmann
2021-09-28 15:23:42 +02:00
parent ebc753cf9b
commit 39738dee77
4 changed files with 31 additions and 3 deletions

View File

@@ -251,6 +251,10 @@ StaticAnalysisMessages::StaticAnalysisMessages()
tr("Type cannot be instantiated recursively (%1)."), 1);
newMsg(WarnLogicalValueDoesNotDependOnValues, Warning,
tr("Logical value does not depend on actual values"));
newMsg(ErrToManyComponentChildren, Error,
tr("Components are only allowed to have a single child element."));
newMsg(WarnComponentRequiresChildren, Warning,
tr("Components require a child element."));
}
} // anonymous namespace