diff options
-rw-r--r-- | src/qmlcompiler/qqmljscompiler.cpp | 5 | ||||
-rw-r--r-- | src/qmlcompiler/qqmljslogger_p.h | 14 | ||||
-rw-r--r-- | tools/qmlcachegen/qmlcachegen.cpp | 1 |
3 files changed, 17 insertions, 3 deletions
diff --git a/src/qmlcompiler/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp index 76a7ed80e2..9e4c3a1cbb 100644 --- a/src/qmlcompiler/qqmljscompiler.cpp +++ b/src/qmlcompiler/qqmljscompiler.cpp @@ -648,9 +648,8 @@ QQmlJS::DiagnosticMessage QQmlJSAotCompiler::diagnose( const QString &message, QtMsgType type, const QQmlJS::SourceLocation &location) const { if (isStrict(m_document) - && (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg) - && !m_logger->isCategoryIgnored(Log_Compiler) - && m_logger->categoryLevel(Log_Compiler) == QtCriticalMsg) { + && (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg) + && m_logger->isCategoryFatal(Log_Compiler)) { qFatal("%s:%d: (strict mode) %s", qPrintable(QFileInfo(m_resourcePath).fileName()), location.startLine, qPrintable(message)); diff --git a/src/qmlcompiler/qqmljslogger_p.h b/src/qmlcompiler/qqmljslogger_p.h index 0302201eaf..9c89fd754a 100644 --- a/src/qmlcompiler/qqmljslogger_p.h +++ b/src/qmlcompiler/qqmljslogger_p.h @@ -201,6 +201,16 @@ public: m_categoryChanged[category] = true; } + bool isCategoryFatal(QQmlJSLoggerCategory category) const + { + return m_categoryFatal[category]; + } + void setCategoryFatal(QQmlJSLoggerCategory category, bool error) + { + m_categoryFatal[category] = error; + m_categoryChanged[category] = true; + } + bool wasCategoryChanged(QQmlJSLoggerCategory category) const { return m_categoryChanged[category]; @@ -257,6 +267,10 @@ private: bool m_categoryIgnored[QQmlJSLoggerCategory_Last + 1] = {}; bool m_categoryChanged[QQmlJSLoggerCategory_Last + 1] = {}; + // If true, triggers qFatal on documents with "pragma Strict" + // TODO: Works only for qmlCompiler category so far. + bool m_categoryFatal[QQmlJSLoggerCategory_Last + 1] = {}; + QList<Message> m_infos; QList<Message> m_warnings; QList<Message> m_errors; diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp index 3a74f587e9..141c010272 100644 --- a/tools/qmlcachegen/qmlcachegen.cpp +++ b/tools/qmlcachegen/qmlcachegen.cpp @@ -246,6 +246,7 @@ int main(int argc, char **argv) // Always trigger the qFatal() on "pragma Strict" violations. logger.setCategoryLevel(Log_Compiler, QtCriticalMsg); logger.setCategoryIgnored(Log_Compiler, false); + logger.setCategoryFatal(Log_Compiler, true); // By default, we're completely silent, // as the lcAotCompiler category default is QtFatalMsg |