diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2022-02-04 22:35:23 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-02-16 14:44:39 +0100 |
| commit | be90de3dc1efc447f17a5fc6ba5f0c6aa760f9a4 (patch) | |
| tree | 2a9a0b18bee911769fde02c56700ed88f3393f42 /src/qmlcompiler/qqmljsfunctioninitializer.cpp | |
| parent | 160190968df4a2b5163700a2aebd88842d0c784e (diff) | |
QmlCompiler: track register contents by cloning types
Whenever we write a register, we create a new type. This way, whenever
we determine that a different type would be a better fit at that place,
we can just change the type in place, without affecting any unrelated
code.
Task-number: QTBUG-100157
Change-Id: I70be2eb83bda5483e083f58113fdfe57224b237e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsfunctioninitializer.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljsfunctioninitializer.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/qmlcompiler/qqmljsfunctioninitializer.cpp b/src/qmlcompiler/qqmljsfunctioninitializer.cpp index 7898b25c59..4687c6bc0b 100644 --- a/src/qmlcompiler/qqmljsfunctioninitializer.cpp +++ b/src/qmlcompiler/qqmljsfunctioninitializer.cpp @@ -92,14 +92,15 @@ void QQmlJSFunctionInitializer::populateSignature( for (const QQmlJS::AST::BoundName &argument : qAsConst(arguments)) { if (argument.typeAnnotation) { if (const auto type = m_typeResolver->typeFromAST(argument.typeAnnotation->type)) { - function->argumentTypes.append(type); + function->argumentTypes.append(m_typeResolver->tracked(type)); } else { - function->argumentTypes.append(m_typeResolver->varType()); + function->argumentTypes.append( + m_typeResolver->tracked(m_typeResolver->varType())); signatureError(u"Cannot resolve the argument type %1."_qs .arg(argument.typeAnnotation->type->toString())); } } else { - function->argumentTypes.append(m_typeResolver->varType()); + function->argumentTypes.append(m_typeResolver->tracked(m_typeResolver->varType())); signatureError(u"Functions without type annotations won't be compiled"_qs); } } |
