From 8fc545de4166eb3c73833e9d9136dfbebf43539a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 15 Jan 2014 13:32:42 +0100 Subject: [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 --- src/qml/compiler/qqmltypecompiler.cpp | 20 ++++++-------------- src/qml/compiler/qqmltypecompiler_p.h | 2 -- 2 files changed, 6 insertions(+), 16 deletions(-) (limited to 'src/qml') 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 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 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; }; -- cgit v1.2.3