summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-05-26 05:13:43 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-05-26 05:13:43 (GMT)
commit4c1cdb0bf25847a8ebf42cf573faf5b2386000b9 (patch)
treeb496e5e8b8b01a009e7575dfee7734dcdd0d38fd /src/declarative/qml
parent478a339bc668611f6e31803e26c502a2aabe7bfe (diff)
downloadQt-4c1cdb0bf25847a8ebf42cf573faf5b2386000b9.zip
Qt-4c1cdb0bf25847a8ebf42cf573faf5b2386000b9.tar.gz
Qt-4c1cdb0bf25847a8ebf42cf573faf5b2386000b9.tar.bz2
Ensure tests pass
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qmlcompiler.cpp49
-rw-r--r--src/declarative/qml/qmlcompiler_p.h5
-rw-r--r--src/declarative/qml/qmlcompositetypemanager.cpp2
3 files changed, 33 insertions, 23 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();
}
diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h
index bc04cfa..5ada98a 100644
--- a/src/declarative/qml/qmlcompiler_p.h
+++ b/src/declarative/qml/qmlcompiler_p.h
@@ -170,9 +170,8 @@ private:
int optimizeExpressions(int start, int end, int patch = -1);
QSet<QString> ids;
- qint64 exceptionLine;
- qint64 exceptionColumn;
- QString exceptionDescription;
+
+ QList<QmlError> exceptions;
QmlCompiledData *output;
};
diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp
index 0da1a92..a5e302c 100644
--- a/src/declarative/qml/qmlcompositetypemanager.cpp
+++ b/src/declarative/qml/qmlcompositetypemanager.cpp
@@ -86,6 +86,8 @@ QmlComponent *QmlCompositeTypeData::toComponent(QmlEngine *engine)
component = new QmlComponent(engine, cc, -1, -1, 0);
} else {
component = new QmlComponent(engine, 0);
+ component->d_func()->url = QUrl(url);
+ component->d_func()->errors = errors;
}
}