diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-01-15 16:17:22 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-17 08:10:07 +0100 |
commit | 814504306df0b76da1654a74524bdc353527d06f (patch) | |
tree | d20bd388b6992e2e36c66f809070428235e7522b /src/qml/compiler | |
parent | 8fc545de4166eb3c73833e9d9136dfbebf43539a (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.cpp | 7 | ||||
-rw-r--r-- | src/qml/compiler/qqmltypecompiler_p.h | 6 |
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); |