From d70abd83dc94d722cde6d4b19b9d35c5f4f19946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20De=20Canni=C3=A8re?= Date: Fri, 2 Aug 2024 10:13:44 +0200 Subject: 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 Reviewed-by: Sami Shalayel --- src/qmlcompiler/qqmljsstorageinitializer.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/qmlcompiler/qqmljsstorageinitializer.cpp') 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())); } }; -- cgit v1.2.3