aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsstorageinitializer.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/qqmljsstorageinitializer.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/qqmljsstorageinitializer.cpp')
-rw-r--r--src/qmlcompiler/qqmljsstorageinitializer.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/qmlcompiler/qqmljsstorageinitializer.cpp b/src/qmlcompiler/qqmljsstorageinitializer.cpp
index b0f7d1a49f..27169001f2 100644
--- a/src/qmlcompiler/qqmljsstorageinitializer.cpp
+++ b/src/qmlcompiler/qqmljsstorageinitializer.cpp
@@ -16,18 +16,16 @@ QT_BEGIN_NAMESPACE
* operates only on the annotations and the function description.
*/
-QQmlJSCompilePass::BlocksAndAnnotations
-QQmlJSStorageInitializer::run(Function *function, QQmlJS::DiagnosticMessage *error)
+QQmlJSCompilePass::BlocksAndAnnotations QQmlJSStorageInitializer::run(Function *function)
{
m_function = function;
- m_error = error;
if (QQmlJSRegisterContent &returnType = function->returnType; returnType.isValid()) {
if (const QQmlJSScope::ConstPtr stored
= m_typeResolver->storedType(returnType.containedType())) {
returnType = returnType.storedIn(m_typeResolver->trackedType(stored));
} else {
- setError(QStringLiteral("Cannot store the return type %1.")
+ addError(QStringLiteral("Cannot store the return type %1.")
.arg(returnType.containedType()->internalName()));
return {};
}
@@ -47,7 +45,7 @@ QQmlJSStorageInitializer::run(Function *function, QQmlJS::DiagnosticMessage *err
= m_typeResolver->storedType(content.containedType());
if (!m_typeResolver->adjustTrackedType(originalTracked, adjustedStored)) {
- setError(QStringLiteral("Cannot adjust stored type for %1.")
+ addError(QStringLiteral("Cannot adjust stored type for %1.")
.arg(content.containedType()->internalName()));
}
};