From a885d10a0289da85b8c966d2fa40fb10edae4fd7 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 12 Mar 2014 16:55:06 +0100 Subject: Extend the QML bootstrap library by the IR builders This is among other things needed to fix the qml import scanner to detect dependencies from .js files correctly. The patch also fixes the use of Q_QML_EXPORT towards Q_QML_PRIVATE_EXPORT where appropriate and corrects the wrong include path for the double conversion code to actually be relative to the file it is included from. This worked by accident because of other include paths present in the build. Change-Id: I338583dad2f76300819af8ab0dae8e5724c84430 Reviewed-by: Lars Knoll --- src/qml/qml/qqmldirparser.cpp | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'src/qml/qml/qqmldirparser.cpp') diff --git a/src/qml/qml/qqmldirparser.cpp b/src/qml/qml/qqmldirparser.cpp index c1d0132c61..a2b4b5edd0 100644 --- a/src/qml/qml/qqmldirparser.cpp +++ b/src/qml/qml/qqmldirparser.cpp @@ -41,9 +41,7 @@ #include "qqmldirparser_p.h" #include "qqmlerror.h" -#include "qqmlglobal_p.h" -#include #include QT_BEGIN_NAMESPACE @@ -281,10 +279,10 @@ bool QQmlDirParser::parse(const QString &source) void QQmlDirParser::reportError(quint16 line, quint16 column, const QString &description) { - QQmlError error; - error.setLine(line); - error.setColumn(column); - error.setDescription(description); + QQmlJS::DiagnosticMessage error; + error.loc.startLine = line; + error.loc.startColumn = column; + error.message = description; _errors.append(error); } @@ -296,25 +294,41 @@ bool QQmlDirParser::hasError() const return false; } +#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB) +QList QQmlDirParser::errors(const QString &uri) const +{ + QList errors = _errors; + for (int i = 0; i < errors.size(); ++i) { + QQmlJS::DiagnosticMessage &msg = errors[i]; + msg.message.replace(QLatin1String("$$URI$$"), uri); + } + return errors; +} +#else void QQmlDirParser::setError(const QQmlError &e) { _errors.clear(); - _errors.append(e); + reportError(e.line(), e.column(), e.description()); } QList QQmlDirParser::errors(const QString &uri) const { QUrl url(uri); - QList errors = _errors; - for (int i = 0; i < errors.size(); ++i) { - QQmlError &e = errors[i]; - QString description = e.description(); + QList errors; + for (int i = 0; i < _errors.size(); ++i) { + const QQmlJS::DiagnosticMessage &msg = _errors.at(i); + QQmlError e; + QString description = msg.message; description.replace(QLatin1String("$$URI$$"), uri); e.setDescription(description); e.setUrl(url); + e.setLine(msg.loc.startLine); + e.setColumn(msg.loc.startColumn); + errors << e; } return errors; } +#endif QString QQmlDirParser::typeNamespace() const { @@ -331,7 +345,7 @@ QList QQmlDirParser::plugins() const return _plugins; } -QHash QQmlDirParser::components() const +QHash QQmlDirParser::components() const { return _components; } -- cgit v1.2.3