diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2022-02-21 17:35:44 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-03-03 18:44:21 +0100 |
| commit | 4679710f4d9d44605fa55022d8d6d2fd19d7176a (patch) | |
| tree | a305eacf6eaa34488af181b89f364eaf1027cc22 /src/qmlcompiler/qqmljsstoragegeneralizer.cpp | |
| parent | 8dd7201994c41a5adb8f26a43509fd0dab031bf7 (diff) | |
QmlCompiler: Store arguments as QQmlJSRegisterContent
This way we can uniquely track the stored types throughout the
compilation.
Change-Id: Ibf3814a37f105c2eede2a08f547ab5fbfa1c16e2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsstoragegeneralizer.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljsstoragegeneralizer.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/qmlcompiler/qqmljsstoragegeneralizer.cpp b/src/qmlcompiler/qqmljsstoragegeneralizer.cpp index 9af98eed85..889150f2dd 100644 --- a/src/qmlcompiler/qqmljsstoragegeneralizer.cpp +++ b/src/qmlcompiler/qqmljsstoragegeneralizer.cpp @@ -61,18 +61,6 @@ QQmlJSCompilePass::InstructionAnnotations QQmlJSStorageGeneralizer::run( } } - for (QQmlJSScope::ConstPtr &argument : function->argumentTypes) { - Q_ASSERT(argument); - if (QQmlJSScope::ConstPtr stored = m_typeResolver->genericType( - argument, QQmlJSTypeResolver::ComponentIsGeneric::Yes)) { - argument = std::move(stored); - } else { - setError(QStringLiteral("Cannot store the argument type %1.") - .arg(argument->internalName(), 0)); - return InstructionAnnotations(); - } - } - const auto transformRegister = [&](QQmlJSRegisterContent &content, int offset) { if (QQmlJSScope::ConstPtr specific = content.storedType()) { if (QQmlJSScope::ConstPtr generic = m_typeResolver->genericType(specific)) { @@ -95,6 +83,11 @@ QQmlJSCompilePass::InstructionAnnotations QQmlJSStorageGeneralizer::run( return true; }; + for (QQmlJSRegisterContent &argument : function->argumentTypes) { + Q_ASSERT(argument.isValid()); + transformRegister(argument, 0); + } + for (auto i = annotations.begin(), iEnd = annotations.end(); i != iEnd; ++i) { if (!transformRegister(i->second.changedRegister, i.key())) return InstructionAnnotations(); |
