diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-06-14 11:11:18 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-06-16 18:00:32 +0000 |
commit | c2c13cacd450d866e60c58c87ff1ab16ae736804 (patch) | |
tree | 036a78caefe83045508bd18b3fe9c41aec32fe25 /src/qml/compiler/qqmltypecompiler_p.h | |
parent | 79745bf95cfb656b7ea75850c2b378cac3ea18ec (diff) |
Clean up property cache creation code
* Reduce the complexity of the recursive tree traversal by moving
the base type property cache creation into a helper function and using a
context to encapsulate the origin of the current traversal
* ensureVMEMetaObject() had only one call site and it's easiest to
inline that for now.
* Transition to a new state-less error handling, so that in the future
this code can be used without the QQmlTypeCompiler dependency, which
will be needed for loading of compilation units from disk.
* A few missing consts.
Change-Id: Ibe7209c357a3c7e101fac6960ece40a033e55f72
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qqmltypecompiler_p.h')
-rw-r--r-- | src/qml/compiler/qqmltypecompiler_p.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qml/compiler/qqmltypecompiler_p.h b/src/qml/compiler/qqmltypecompiler_p.h index c67137bcbd..5e8bf4538e 100644 --- a/src/qml/compiler/qqmltypecompiler_p.h +++ b/src/qml/compiler/qqmltypecompiler_p.h @@ -126,6 +126,17 @@ private: QQmlPropertyCacheVector m_propertyCaches; }; +struct QQmlCompileError +{ + QQmlCompileError() {} + QQmlCompileError(const QV4::CompiledData::Location &location, const QString &description) + : location(location), description(description) {} + QV4::CompiledData::Location location; + QString description; + + bool isSet() const { return !description.isEmpty(); } +}; + struct QQmlCompilePass { virtual ~QQmlCompilePass() {} @@ -135,6 +146,8 @@ struct QQmlCompilePass QString stringAt(int idx) const { return compiler->stringAt(idx); } protected: void recordError(const QV4::CompiledData::Location &location, const QString &description) const; + void recordError(const QQmlCompileError &error) + { recordError(error.location, error.description); } QQmlTypeCompiler *compiler; }; |