aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmldirparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmldirparser.cpp')
-rw-r--r--src/qml/qml/qqmldirparser.cpp48
1 files changed, 10 insertions, 38 deletions
diff --git a/src/qml/qml/qqmldirparser.cpp b/src/qml/qml/qqmldirparser.cpp
index 82289311c9..2da4a3300b 100644
--- a/src/qml/qml/qqmldirparser.cpp
+++ b/src/qml/qml/qqmldirparser.cpp
@@ -43,6 +43,7 @@
#include "qqmlerror.h"
#include "qqmlglobal_p.h"
+#include <QtQml/qqmlfile.h>
#include <QtCore/QTextStream>
#include <QtCore/QFile>
#include <QtCore/QtDebug>
@@ -58,26 +59,6 @@ QQmlDirParser::~QQmlDirParser()
{
}
-QUrl QQmlDirParser::url() const
-{
- return _url;
-}
-
-void QQmlDirParser::setUrl(const QUrl &url)
-{
- _url = url;
-}
-
-QString QQmlDirParser::fileSource() const
-{
- return _filePathSouce;
-}
-
-void QQmlDirParser::setFileSource(const QString &filePath)
-{
- _filePathSouce = filePath;
-}
-
QString QQmlDirParser::source() const
{
return _source;
@@ -94,6 +75,9 @@ bool QQmlDirParser::isParsed() const
return _isParsed;
}
+/*!
+\a url is used for generating errors.
+*/
bool QQmlDirParser::parse()
{
if (_isParsed)
@@ -105,23 +89,6 @@ bool QQmlDirParser::parse()
_components.clear();
_scripts.clear();
- if (_source.isEmpty() && !_filePathSouce.isEmpty()) {
- QFile file(_filePathSouce);
- if (!QQml_isFileCaseCorrect(_filePathSouce)) {
- QQmlError error;
- error.setDescription(QString::fromUtf8("cannot load module \"$$URI$$\": File name case mismatch for \"%1\"").arg(_filePathSouce));
- _errors.prepend(error);
- return false;
- } else if (file.open(QFile::ReadOnly)) {
- _source = QString::fromUtf8(file.readAll());
- } else {
- QQmlError error;
- error.setDescription(QString::fromUtf8("module \"$$URI$$\" definition \"%1\" not readable").arg(_filePathSouce));
- _errors.prepend(error);
- return false;
- }
- }
-
QTextStream stream(&_source);
int lineNumber = 0;
@@ -246,7 +213,6 @@ bool QQmlDirParser::parse()
void QQmlDirParser::reportError(int line, int column, const QString &description)
{
QQmlError error;
- error.setUrl(_url);
error.setLine(line);
error.setColumn(column);
error.setDescription(description);
@@ -261,6 +227,12 @@ bool QQmlDirParser::hasError() const
return false;
}
+void QQmlDirParser::setError(const QQmlError &e)
+{
+ _errors.clear();
+ _errors.append(e);
+}
+
QList<QQmlError> QQmlDirParser::errors(const QString &uri) const
{
QList<QQmlError> errors = _errors;