diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-09-30 08:37:37 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-30 18:21:45 +0200 |
commit | 385890bfdb165b397b29d3b62099f0687b358510 (patch) | |
tree | 3a1fd22eec98e521e560ae0d4cdfe16fa84ea045 /src/qml/qml/qqmlobjectcreator_p.h | |
parent | d05151d735540f22ee3af75fdc7b2848dde2fe6f (diff) |
Fix error messages when assigning to non-existent properties in new compiler
Introduce a simple valdator pass early on to catch those assignments. Also
fix storing the correct line/col for default property object bindings and
remember the minor/major version of an import in the final type reference.
Change-Id: Ib2a93dfe1a30fcd9c09b5443fb8199ad11b19769
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator_p.h')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator_p.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h index 8412e227dd..ec4b362491 100644 --- a/src/qml/qml/qqmlobjectcreator_p.h +++ b/src/qml/qml/qqmlobjectcreator_p.h @@ -115,6 +115,27 @@ protected: QHash<int, QHash<int, int> > *objectIndexToIdPerComponent; }; +class QQmlPropertyValidator : public QQmlCompilePass +{ + Q_DECLARE_TR_FUNCTIONS(QQmlPropertyValidator) +public: + QQmlPropertyValidator(const QUrl &url, const QV4::CompiledData::QmlUnit *qmlUnit, + const QHash<int, QQmlCompiledData::TypeReference> &resolvedTypes, + const QList<QQmlPropertyCache *> &propertyCaches, + const QHash<int, QHash<int, int> > &objectIndexToIdPerComponent); + + bool validate(); + +private: + bool validateObject(const QV4::CompiledData::Object *obj, int objectIndex, QQmlPropertyCache *propertyCache); + + bool isComponent(int objectIndex) const { return objectIndexToIdPerComponent.contains(objectIndex); } + + const QHash<int, QQmlCompiledData::TypeReference> &resolvedTypes; + const QList<QQmlPropertyCache *> &propertyCaches; + const QHash<int, QHash<int, int> > objectIndexToIdPerComponent; +}; + class QmlObjectCreator : public QQmlCompilePass { Q_DECLARE_TR_FUNCTIONS(QmlObjectCreator) |