diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-01-15 13:32:42 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-17 08:10:07 +0100 |
commit | 8fc545de4166eb3c73833e9d9136dfbebf43539a (patch) | |
tree | 1ba7274ee48920c3c43a04c00ac7dcc0350ffa2d | |
parent | 6547d53e6555f90065c045b718084557001f0245 (diff) |
[new compiler] Fix error reporting location for custom parsers
After the binding of QQmlCompilePass to QQmlTypeCompiler, I forgot to
change the customer parser handling to also report the errors correctly
back to the QQmlTypeCompiler. Instead they were collected locally with an
empty url.
Change-Id: I5ee527a77e27c0339c507f326a3b0f0837353db3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r-- | src/qml/compiler/qqmltypecompiler.cpp | 20 | ||||
-rw-r--r-- | src/qml/compiler/qqmltypecompiler_p.h | 2 |
2 files changed, 6 insertions, 16 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp index 06f0be5944..56351b0013 100644 --- a/src/qml/compiler/qqmltypecompiler.cpp +++ b/src/qml/compiler/qqmltypecompiler.cpp @@ -101,10 +101,8 @@ bool QQmlTypeCompiler::compile() { QQmlPropertyCacheCreator propertyCacheBuilder(this); - if (!propertyCacheBuilder.buildMetaObjects()) { - errors << propertyCacheBuilder.errors; + if (!propertyCacheBuilder.buildMetaObjects()) return false; - } } { @@ -141,10 +139,8 @@ bool QQmlTypeCompiler::compile() { // Scan for components, determine their scopes and resolve aliases within the scope. QQmlComponentAndAliasResolver resolver(this); - if (!resolver.resolve()) { - errors << resolver.errors; + if (!resolver.resolve()) return false; - } } // Compile JS binding expressions and signal handlers @@ -191,10 +187,8 @@ bool QQmlTypeCompiler::compile() // Sanity check property bindings QQmlPropertyValidator validator(this); - if (!validator.validate()) { - errors << validator.errors; + if (!validator.validate()) return false; - } return errors.isEmpty(); } @@ -909,7 +903,7 @@ bool QQmlComponentAndAliasResolver::resolve() resolveAliases(); - return errors.isEmpty(); + return true; } bool QQmlComponentAndAliasResolver::collectIdsAndAliases(int objectIndex) @@ -1191,10 +1185,8 @@ bool QQmlPropertyValidator::validateObject(const QV4::CompiledData::Object *obj, customParserData->insert(objectIndex, data); const QList<QQmlError> parserErrors = customParser->errors(); if (!parserErrors.isEmpty()) { - foreach (QQmlError error, parserErrors) { - error.setUrl(url); - errors << error; - } + foreach (QQmlError error, parserErrors) + compiler->recordError(error); return false; } } diff --git a/src/qml/compiler/qqmltypecompiler_p.h b/src/qml/compiler/qqmltypecompiler_p.h index 03cf3cafe7..bd136ea9e6 100644 --- a/src/qml/compiler/qqmltypecompiler_p.h +++ b/src/qml/compiler/qqmltypecompiler_p.h @@ -106,13 +106,11 @@ struct QQmlCompilePass virtual ~QQmlCompilePass() {} QQmlCompilePass(QQmlTypeCompiler *typeCompiler); - QList<QQmlError> errors; QString stringAt(int idx) const { return compiler->stringAt(idx); } protected: void recordError(const QV4::CompiledData::Location &location, const QString &description); - const QUrl url; QQmlTypeCompiler *compiler; }; |