From 36a4cc1830d4179f327e3b5700794514f3f56e06 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 12 Dec 2013 16:23:14 +0100 Subject: [new compiler] Move component determination and alias resolving Move the code before the JS code generation, as we are going to need the component boundaries for the correct scoping. This requires the component and alias resolver to operate on the pre-compiled-data data structures. Change-Id: I8d2e697d8a05e5a4914db93e785704f6b2434a2e Reviewed-by: Lars Knoll --- src/qml/qml/qqmlobjectcreator_p.h | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/qml/qml/qqmlobjectcreator_p.h') diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h index d395f0238f..796d92a1e6 100644 --- a/src/qml/qml/qqmlobjectcreator_p.h +++ b/src/qml/qml/qqmlobjectcreator_p.h @@ -57,12 +57,12 @@ struct QQmlCompilePass QQmlCompilePass(const QUrl &url, const QStringList &stringTable); QList errors; - QString stringAt(int idx) const { return qmlUnit ? qmlUnit->header.stringAt(idx): stringTable.at(idx); } + QString stringAt(int idx) const { return jsUnit ? jsUnit->stringAt(idx): stringTable.at(idx); } protected: void recordError(const QV4::CompiledData::Location &location, const QString &description); const QUrl url; - const QV4::CompiledData::QmlUnit *qmlUnit; + const QV4::CompiledData::Unit *jsUnit; const QStringList stringTable; }; @@ -86,12 +86,14 @@ class QQmlComponentAndAliasResolver : public QQmlCompilePass { Q_DECLARE_TR_FUNCTIONS(QQmlAnonymousComponentResolver) public: - QQmlComponentAndAliasResolver(const QUrl &url, const QV4::CompiledData::QmlUnit *qmlUnit, - const QHash &resolvedTypes, - const QList &propertyCaches, - QList *vmeMetaObjectData, - QHash *objectIndexToIdForRoot, - QHash > *objectIndexToIdPerComponent); + QQmlComponentAndAliasResolver(const QUrl &url, const QStringList &stringTable, + const QList &qmlObjects, + int indexOfRootObject, + const QHash &resolvedTypes, + const QList &propertyCaches, + QList *vmeMetaObjectData, + QHash *objectIndexToIdForRoot, + QHash > *objectIndexToIdPerComponent); bool resolve(); @@ -102,6 +104,9 @@ protected: bool isComponentType(int typeNameIndex) const { return resolvedTypes.value(typeNameIndex).type == 0; } + const QList &qmlObjects; + const int indexOfRootObject; + // indices of objects that are of type QQmlComponent QVector componentBoundaries; @@ -134,6 +139,7 @@ private: bool isComponent(int objectIndex) const { return objectIndexToIdPerComponent.contains(objectIndex); } + const QV4::CompiledData::QmlUnit *qmlUnit; const QHash &resolvedTypes; const QList &propertyCaches; const QHash > objectIndexToIdPerComponent; @@ -164,6 +170,7 @@ private: void setupFunctions(); QQmlEngine *engine; + const QV4::CompiledData::QmlUnit *qmlUnit; const QV4::CompiledData::CompilationUnit *jsUnit; QQmlContextData *parentContext; QQmlContextData *context; -- cgit v1.2.3