summaryrefslogtreecommitdiff
path: root/src/qmlcompiler/qqmljscompiler.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-03-31 11:26:09 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-04-04 09:09:49 +0200
commitaea732d607dbcc7ba2c86244ca1ab9086bb28ca6 (patch)
treee835adb7bb9dcf26821f8ea68ed14f0ddb4a3249 /src/qmlcompiler/qqmljscompiler.cpp
parent6eaef57cd1fb22ce8070eaf090f4cc111b6f1c95 (diff)
downloadqtdeclarative-aea732d607dbcc7ba2c86244ca1ab9086bb28ca6.tar.gz
Avoid copying QQmlJSScope
The factory should populate the pre-existing scope rather than copy it into place. This way we can detect inheritance cycles involving the pre-existing scope. However, now we may detect the inheritance cycles earlier, when resolving the types inside the lazy loading. We have the right pointers available there now, after all. Therefore, add a way to propagate base type errors out of the factory. When clearing the base type, we can now give a reason for that. When checking the inheritance cycles we retrieve that reason and log it. We also remove the special casing of the ScopeType property of QQmlJSScope. There is no real reason to set it in the ctor. As we delay the population of QQmlJSScope now, we have to set it later. Pick-to: 6.2 6.3 Task-number: QTBUG-102153 Change-Id: I49cf6e20f59fbdb6ed98a82040b3b159676f5975 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljscompiler.cpp')
-rw-r--r--src/qmlcompiler/qqmljscompiler.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qmlcompiler/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp
index c765a1c94e..14811c2aa2 100644
--- a/src/qmlcompiler/qqmljscompiler.cpp
+++ b/src/qmlcompiler/qqmljscompiler.cpp
@@ -645,7 +645,8 @@ void QQmlJSAotCompiler::setDocument(
m_logger->setCode(irDocument->code);
m_unitGenerator = &irDocument->jsGenerator;
m_entireSourceCodeLines = irDocument->code.split(u'\n');
- QQmlJSImportVisitor visitor(m_importer, m_logger,
+ QQmlJSScope::Ptr target = QQmlJSScope::create();
+ QQmlJSImportVisitor visitor(target, m_importer, m_logger,
resourcePathInfo.canonicalPath() + u'/',
m_qmldirFiles);
m_typeResolver.init(&visitor, irDocument->program);