aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-09-17 12:47:47 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-20 14:26:49 +0200
commit1e1dde6a546b4869534928f1c5bdb43b712f75ac (patch)
treef8afb18e8ee04a71945a96b4867bd18e3b5e4bfd /src/qml/qml/qqmlobjectcreator_p.h
parent6b5177a7565c7b4c4f49a636d135f8ea4e443506 (diff)
[new compiler] Cleanups
Collect code for collecting errors and string access for different compile passes (vme creation, qobject creation) in a QQmlCompilePass base class. Change-Id: Ib2119e730ce7d3181599ba29da12273f041f2b70 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.h35
1 files changed, 17 insertions, 18 deletions
diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h
index 6bdcf623ca..eb7a6233c5 100644
--- a/src/qml/qml/qqmlobjectcreator_p.h
+++ b/src/qml/qml/qqmlobjectcreator_p.h
@@ -51,30 +51,36 @@ QT_BEGIN_NAMESPACE
class QQmlAbstractBinding;
-class QQmlPropertyCacheCreator
+struct QQmlCompilePass
+{
+ QQmlCompilePass(const QUrl &url, const QV4::CompiledData::QmlUnit *unit);
+ QList<QQmlError> errors;
+
+protected:
+ QString stringAt(int idx) const { return qmlUnit->header.stringAt(idx); }
+ void recordError(const QV4::CompiledData::Location &location, const QString &description);
+
+ const QUrl url;
+ const QV4::CompiledData::QmlUnit *qmlUnit;
+};
+
+class QQmlPropertyCacheCreator : public QQmlCompilePass
{
Q_DECLARE_TR_FUNCTIONS(QQmlPropertyCacheCreator)
public:
- QQmlPropertyCacheCreator(QQmlEnginePrivate *enginePrivate, const QV4::CompiledData::QmlUnit *unit,
+ QQmlPropertyCacheCreator(QQmlEnginePrivate *enginePrivate, const QV4::CompiledData::QmlUnit *qmlUnit,
const QUrl &url, const QQmlImports *imports,
QHash<int, QQmlCompiledData::TypeReference> *resolvedTypes);
- QList<QQmlError> errors;
-
bool create(const QV4::CompiledData::Object *obj, QQmlPropertyCache **cache, QByteArray *vmeMetaObjectData);
protected:
- QString stringAt(int idx) const { return unit->header.stringAt(idx); }
- void recordError(const QV4::CompiledData::Location &location, const QString &description);
-
QQmlEnginePrivate *enginePrivate;
- const QV4::CompiledData::QmlUnit *unit;
- QUrl url;
const QQmlImports *imports;
QHash<int, QQmlCompiledData::TypeReference> *resolvedTypes;
};
-class QmlObjectCreator
+class QmlObjectCreator : public QQmlCompilePass
{
Q_DECLARE_TR_FUNCTIONS(QmlObjectCreator)
public:
@@ -83,13 +89,11 @@ public:
const QHash<int, int> &objectIndexToId);
QObject *create(QObject *parent = 0)
- { return create(unit->indexOfRootObject, parent); }
+ { return create(qmlUnit->indexOfRootObject, parent); }
QObject *create(int index, QObject *parent = 0);
void finalize();
- QList<QQmlError> errors;
-
QQmlComponentAttached *componentAttached;
QList<QQmlEnginePrivate::FinalizeCallback> finalizeCallbacks;
@@ -101,12 +105,7 @@ private:
void setPropertyValue(QQmlPropertyData *property, const QV4::CompiledData::Binding *binding);
void setupFunctions();
- QString stringAt(int idx) const { return unit->header.stringAt(idx); }
- void recordError(const QV4::CompiledData::Location &location, const QString &description);
-
QQmlEngine *engine;
- QUrl url;
- const QV4::CompiledData::QmlUnit *unit;
const QV4::CompiledData::CompilationUnit *jsUnit;
QQmlContextData *context;
const QHash<int, QQmlCompiledData::TypeReference> resolvedTypes;