diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-04-11 13:02:07 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2025-04-15 19:27:07 +0200 |
| commit | afb51a7e91607a6c99c14d0ae8cd46f8d2954fd2 (patch) | |
| tree | 206d99310ab677d79dcaaab50dd67db20a2ed60c /src/qmlcompiler/qqmljsimportvisitor.cpp | |
| parent | 373782c1c094c22f0efe03b5d2f726631f9ccf46 (diff) | |
qmltc: Cleanly reject custom parsed properties
Process all properties of custom parsed types and generate errors if the
custom parsed properties are actually used. Then print an extra error
stating that qmltc does not support custom parsers.
Pick-to: 6.9 6.8
Fixes: QTBUG-134206
Change-Id: I37e4f3f8d0ee4e0926c0d64c99a4a521b093a1ab
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsimportvisitor.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljsimportvisitor.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/qmlcompiler/qqmljsimportvisitor.cpp b/src/qmlcompiler/qqmljsimportvisitor.cpp index 6ac9a73a61..7af1cff209 100644 --- a/src/qmlcompiler/qqmljsimportvisitor.cpp +++ b/src/qmlcompiler/qqmljsimportvisitor.cpp @@ -603,7 +603,7 @@ void QQmlJSImportVisitor::processDefaultProperties() QQmlJSScope::ConstPtr parentScope = it.key(); // We can't expect custom parser default properties to be sensible, discard them for now. - if (parentScope->isInCustomParserParent()) + if (checkCustomParser(parentScope)) continue; /* consider: @@ -1071,7 +1071,7 @@ void QQmlJSImportVisitor::processPropertyBindings() // These warnings do not apply for custom parsers and their children and need to be // handled on a case by case basis - if (scope->isInCustomParserParent()) + if (checkCustomParser(scope)) continue; // TODO: Can this be in a better suited category? @@ -1273,7 +1273,7 @@ void QQmlJSImportVisitor::addDefaultProperties() m_pendingDefaultProperties[m_currentScope->parentScope()] << m_currentScope; - if (parentScope->isInCustomParserParent()) + if (checkCustomParser(parentScope)) return; /* consider: @@ -1370,7 +1370,7 @@ void QQmlJSImportVisitor::checkGroupedAndAttachedScopes(QQmlJSScope::ConstPtr sc { // These warnings do not apply for custom parsers and their children and need to be handled on a // case by case basis - if (scope->isInCustomParserParent()) + if (checkCustomParser(scope)) return; auto children = scope->childScopes(); @@ -1396,6 +1396,11 @@ void QQmlJSImportVisitor::checkGroupedAndAttachedScopes(QQmlJSScope::ConstPtr sc } } +bool QQmlJSImportVisitor::checkCustomParser(const QQmlJSScope::ConstPtr &scope) +{ + return scope->isInCustomParserParent(); +} + void QQmlJSImportVisitor::flushPendingSignalParameters() { const QQmlJSMetaSignalHandler handler = m_signalHandlers[m_pendingSignalHandler]; @@ -2390,7 +2395,7 @@ void QQmlJSImportVisitor::endVisit(UiArrayBinding *arrayBinding) const auto propertyName = getScopeName(m_currentScope, QQmlSA::ScopeType::QMLScope); leaveEnvironment(); - if (m_currentScope->isInCustomParserParent()) { + if (checkCustomParser(m_currentScope)) { // These warnings do not apply for custom parsers and their children and need to be handled // on a case by case basis return; @@ -2951,7 +2956,7 @@ void QQmlJSImportVisitor::endVisit(QQmlJS::AST::UiObjectBinding *uiob) } } - if (m_currentScope->isInCustomParserParent()) { + if (checkCustomParser(m_currentScope)) { // These warnings do not apply for custom parsers and their children and need to be handled // on a case by case basis } else { |
