diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-26 05:13:43 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-26 05:13:43 (GMT) |
commit | 4c1cdb0bf25847a8ebf42cf573faf5b2386000b9 (patch) | |
tree | b496e5e8b8b01a009e7575dfee7734dcdd0d38fd /src/declarative/qml/qmlcompiler.cpp | |
parent | 478a339bc668611f6e31803e26c502a2aabe7bfe (diff) | |
download | Qt-4c1cdb0bf25847a8ebf42cf573faf5b2386000b9.zip Qt-4c1cdb0bf25847a8ebf42cf573faf5b2386000b9.tar.gz Qt-4c1cdb0bf25847a8ebf42cf573faf5b2386000b9.tar.bz2 |
Ensure tests pass
Diffstat (limited to 'src/declarative/qml/qmlcompiler.cpp')
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 5f92721..a247f8b 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -154,28 +154,18 @@ int QmlCompiledData::indexForLocation(const QmlParser::LocationSpan &l) } QmlCompiler::QmlCompiler() -: exceptionLine(-1), exceptionColumn(-1), output(0) +: output(0) { } bool QmlCompiler::isError() const { - return exceptionLine != -1; + return !exceptions.isEmpty(); } QList<QmlError> QmlCompiler::errors() const { - QList<QmlError> rv; - - if(isError()) { - QmlError error; - error.setDescription(exceptionDescription); - error.setLine(exceptionLine); - error.setColumn(exceptionColumn); - rv << error; - } - - return rv; + return exceptions; } bool QmlCompiler::isValidId(const QString &val) @@ -436,21 +426,29 @@ void QmlCompiler::reset(QmlCompiledComponent *cc, bool deleteMemory) #define COMPILE_EXCEPTION2(token, desc) \ { \ - exceptionLine = token->location.start.line; \ - exceptionColumn = token->location.start.column; \ + QString exceptionDescription; \ + QmlError error; \ + error.setUrl(output->url); \ + error.setLine(token->location.start.line); \ + error.setColumn(token->location.start.column); \ QDebug d(&exceptionDescription); \ d << desc; \ - exceptionDescription = exceptionDescription.trimmed(); \ + error.setDescription(exceptionDescription.trimmed()); \ + exceptions << error; \ return false; \ } #define COMPILE_EXCEPTION(desc) \ { \ - exceptionLine = obj->location.start.line; \ - exceptionColumn = obj->location.start.column; \ + QString exceptionDescription; \ + QmlError error; \ + error.setUrl(output->url); \ + error.setLine(obj->location.start.line); \ + error.setColumn(obj->location.start.column); \ QDebug d(&exceptionDescription); \ d << desc; \ - exceptionDescription = exceptionDescription.trimmed(); \ + error.setDescription(exceptionDescription.trimmed()); \ + exceptions << error; \ return false; \ } @@ -466,7 +464,7 @@ bool QmlCompiler::compile(QmlEngine *engine, #ifdef Q_ENABLE_PERFORMANCE_LOG QFxPerfTimer<QFxPerf::Compile> pc; #endif - exceptionLine = -1; + exceptions.clear(); Q_ASSERT(out); reset(out, true); @@ -481,6 +479,17 @@ bool QmlCompiler::compile(QmlEngine *engine, ref.type = tref.type; else if (tref.unit) { ref.component = tref.unit->toComponent(engine); + + if (ref.component->isError()) { + QmlError error; + error.setUrl(output->url); + error.setDescription(QLatin1String("Unable to create type ") + + unit->data.types().at(ii)); + exceptions << error; + exceptions << ref.component->errors(); + reset(out, true); + return false; + } ref.ref = tref.unit; ref.ref->addref(); } |