aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmldirparser.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-03-12 16:55:06 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-23 21:16:46 +0200
commita885d10a0289da85b8c966d2fa40fb10edae4fd7 (patch)
tree7c16b5abd88d436f6596d6a424126c1b1dd2aba8 /src/qml/qml/qqmldirparser.cpp
parent937fdde5d3b26291d417f856ee05ba479a6ba730 (diff)
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 <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmldirparser.cpp')
-rw-r--r--src/qml/qml/qqmldirparser.cpp38
1 files changed, 26 insertions, 12 deletions
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 <QtQml/qqmlfile.h>
#include <QtCore/QtDebug>
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<QQmlJS::DiagnosticMessage> QQmlDirParser::errors(const QString &uri) const
+{
+ QList<QQmlJS::DiagnosticMessage> 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<QQmlError> QQmlDirParser::errors(const QString &uri) const
{
QUrl url(uri);
- QList<QQmlError> errors = _errors;
- for (int i = 0; i < errors.size(); ++i) {
- QQmlError &e = errors[i];
- QString description = e.description();
+ QList<QQmlError> 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::Plugin> QQmlDirParser::plugins() const
return _plugins;
}
-QHash<QHashedStringRef,QQmlDirParser::Component> QQmlDirParser::components() const
+QHash<QString, QQmlDirParser::Component> QQmlDirParser::components() const
{
return _components;
}