aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmltypecompiler_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-01-31 12:18:51 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-03 14:38:03 +0100
commitfd52557b1f20a0464bb4b594d0e5897fa44e723b (patch)
tree55d522d4738e12439871458251d3a05216ee0d89 /src/qml/compiler/qqmltypecompiler_p.h
parent043acc2332056d087966d5723b26b0fa610d1375 (diff)
[new compiler] Try to resolve qualified enums at type compile time
... by taking some code from the old compiler. This speeds up some bindings and maintains compatibility. Change-Id: If80b1e28214cb655f70fff01a8c885edcb2d3030 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qqmltypecompiler_p.h')
-rw-r--r--src/qml/compiler/qqmltypecompiler_p.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/qml/compiler/qqmltypecompiler_p.h b/src/qml/compiler/qqmltypecompiler_p.h
index b698d98f4e..262bd550ce 100644
--- a/src/qml/compiler/qqmltypecompiler_p.h
+++ b/src/qml/compiler/qqmltypecompiler_p.h
@@ -139,6 +139,30 @@ protected:
QVector<QQmlPropertyCache*> propertyCaches;
};
+// ### This will go away when the codegen resolves all enums to constant expressions
+// and we replace the constant expression with a literal binding instead of using
+// a script.
+class QQmlEnumTypeResolver : public QQmlCompilePass
+{
+ Q_DECLARE_TR_FUNCTIONS(QQmlEnumTypeResolver)
+public:
+ QQmlEnumTypeResolver(QQmlTypeCompiler *typeCompiler);
+
+ bool resolveEnumBindings();
+
+private:
+ bool tryQualifiedEnumAssignment(const QmlObject *obj, const QQmlPropertyCache *propertyCache,
+ const QQmlPropertyData *prop,
+ QtQml::Binding *binding);
+ int evaluateEnum(const QString &scope, const QByteArray &enumValue, bool *ok) const;
+
+
+ const QList<QtQml::QmlObject*> &qmlObjects;
+ const QVector<QQmlPropertyCache *> propertyCaches;
+ const QQmlImports *imports;
+ QHash<int, QQmlCompiledData::TypeReference *> *resolvedTypes;
+};
+
class QQmlComponentAndAliasResolver : public QQmlCompilePass
{
Q_DECLARE_TR_FUNCTIONS(QQmlAnonymousComponentResolver)