aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsstoragegeneralizer.cpp
diff options
context:
space:
mode:
authorOlivier De Cannière <olivier.decanniere@qt.io>2024-08-02 10:13:44 +0200
committerOlivier De Cannière <olivier.decanniere@qt.io>2024-08-21 19:57:58 +0200
commitd70abd83dc94d722cde6d4b19b9d35c5f4f19946 (patch)
tree1119f20b6f64d71b4602e7d4e39f7dc0c2caeec4 /src/qmlcompiler/qqmljsstoragegeneralizer.cpp
parent06577c9e80eb150b6b9e76e7805bfed1abbae82d (diff)
Compiler: Create infrastructure to support multiple warnings
Currently only one DiagnosticMessage can be stored at a time when using the compiler. However, we want to be able to show more than one to the user. Therefore, use a list that gets passed inside the compiler instead of a pointer to the sole error. This also means that the error is valid by its very existence. There is no need to check validity explicitly anymore. Task-number: QTBUG-127624 Change-Id: I356db917b86703b508dc1ad52de7825d82eafd71 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsstoragegeneralizer.cpp')
-rw-r--r--src/qmlcompiler/qqmljsstoragegeneralizer.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/qmlcompiler/qqmljsstoragegeneralizer.cpp b/src/qmlcompiler/qqmljsstoragegeneralizer.cpp
index 3ba709b21f..ce9f096ac6 100644
--- a/src/qmlcompiler/qqmljsstoragegeneralizer.cpp
+++ b/src/qmlcompiler/qqmljsstoragegeneralizer.cpp
@@ -19,18 +19,16 @@ QT_BEGIN_NAMESPACE
* operates only on the annotations and the function description.
*/
-QQmlJSCompilePass::BlocksAndAnnotations
-QQmlJSStorageGeneralizer::run(Function *function, QQmlJS::DiagnosticMessage *error)
+QQmlJSCompilePass::BlocksAndAnnotations QQmlJSStorageGeneralizer::run(Function *function)
{
m_function = function;
- m_error = error;
if (QQmlJSRegisterContent &returnType = function->returnType; returnType.isValid()) {
if (QQmlJSScope::ConstPtr stored = m_typeResolver->genericType(
returnType.storedType(), QQmlJSTypeResolver::ComponentIsGeneric::Yes)) {
returnType = returnType.storedIn(stored);
} else {
- setError(QStringLiteral("Cannot store the return type %1.")
+ addError(QStringLiteral("Cannot store the return type %1.")
.arg(returnType.storedType()->internalName()));
return {};
}