aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-01-15 16:17:22 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-17 08:10:07 +0100
commit814504306df0b76da1654a74524bdc353527d06f (patch)
treed20bd388b6992e2e36c66f809070428235e7522b /src/qml/compiler
parent8fc545de4166eb3c73833e9d9136dfbebf43539a (diff)
[new compiler] Add support for type and enum resolution for custom parsers
This is in preparation for listmodel support, share the code for resolving types and enums between the old and the new compiler, as all it needs is the imports. Change-Id: I4908d71eee50c769108e0e2b68b03496722fa49d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp7
-rw-r--r--src/qml/compiler/qqmltypecompiler_p.h6
2 files changed, 12 insertions, 1 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index 56351b0013..d6dde63d4b 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -1120,6 +1120,11 @@ bool QQmlPropertyValidator::validate()
return true;
}
+const QQmlImports &QQmlPropertyValidator::imports() const
+{
+ return *compiler->imports();
+}
+
bool QQmlPropertyValidator::validateObject(const QV4::CompiledData::Object *obj, int objectIndex, QQmlPropertyCache *propertyCache)
{
QQmlCustomParser *customParser = 0;
@@ -1181,7 +1186,9 @@ bool QQmlPropertyValidator::validateObject(const QV4::CompiledData::Object *obj,
if (customParser && !customBindings.isEmpty()) {
customParser->clearErrors();
+ customParser->compiler = this;
QByteArray data = customParser->compile(qmlUnit, customBindings);
+ customParser->compiler = 0;
customParserData->insert(objectIndex, data);
const QList<QQmlError> parserErrors = customParser->errors();
if (!parserErrors.isEmpty()) {
diff --git a/src/qml/compiler/qqmltypecompiler_p.h b/src/qml/compiler/qqmltypecompiler_p.h
index bd136ea9e6..248cd12796 100644
--- a/src/qml/compiler/qqmltypecompiler_p.h
+++ b/src/qml/compiler/qqmltypecompiler_p.h
@@ -172,7 +172,7 @@ protected:
QHash<int, QHash<int, int> > *objectIndexToIdPerComponent;
};
-class QQmlPropertyValidator : public QQmlCompilePass
+class QQmlPropertyValidator : public QQmlCompilePass, public QQmlCustomParserCompilerBackend
{
Q_DECLARE_TR_FUNCTIONS(QQmlPropertyValidator)
public:
@@ -180,6 +180,10 @@ public:
bool validate();
+ // Re-implemented for QQmlCustomParser
+ virtual const QQmlImports &imports() const;
+
+
private:
bool validateObject(const QV4::CompiledData::Object *obj, int objectIndex, QQmlPropertyCache *propertyCache);