aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmltypecompiler_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-25 16:36:41 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-02 14:48:43 +0100
commit963875db263e4d1a04e03c4bb4fc20542bc8c21e (patch)
treecbb63607672e9d302d30389c8fe7553b27807b1f /src/qml/compiler/qqmltypecompiler_p.h
parent278ca02350c68a78c89bb34d99ee65968372a5fd (diff)
[new compiler] Compile functions and bindings in appropriate scopes
This enables accelerated property access also for this code path. Change-Id: Iafb177b1fe7878e6c54cfb258f2e8d8ea32aa59e 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.h27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/qml/compiler/qqmltypecompiler_p.h b/src/qml/compiler/qqmltypecompiler_p.h
index 3ef3bbf55f..71ae77ac5c 100644
--- a/src/qml/compiler/qqmltypecompiler_p.h
+++ b/src/qml/compiler/qqmltypecompiler_p.h
@@ -94,7 +94,6 @@ public:
QHash<int, QHash<int, int> > *objectIndexToIdPerComponent();
QHash<int, QByteArray> *customParserData();
QQmlJS::MemoryPool *memoryPool();
- const QList<CompiledFunctionOrExpression> &functions() const;
void setCustomParserBindings(const QVector<int> &bindings);
private:
@@ -216,13 +215,13 @@ class QQmlPropertyValidator : public QQmlCompilePass, public QQmlCustomParserCom
{
Q_DECLARE_TR_FUNCTIONS(QQmlPropertyValidator)
public:
- QQmlPropertyValidator(QQmlTypeCompiler *typeCompiler, const QVector<int> &runtimeFunctionIndices);
+ QQmlPropertyValidator(QQmlTypeCompiler *typeCompiler);
bool validate();
// Re-implemented for QQmlCustomParser
virtual const QQmlImports &imports() const;
- virtual QQmlJS::AST::Node *astForBinding(int scriptIndex) const;
+ virtual QQmlJS::AST::Node *astForBinding(int objectIndex, int scriptIndex) const;
virtual QQmlBinding::Identifier bindingIdentifier(const QV4::CompiledData::Binding *binding, QQmlCustomParser *parser);
private:
@@ -241,7 +240,27 @@ private:
const QHash<int, QHash<int, int> > objectIndexToIdPerComponent;
QHash<int, QByteArray> *customParserData;
QVector<int> customParserBindings;
- const QVector<int> &runtimeFunctionIndices;
+};
+
+// ### merge with QtQml::JSCodeGen and operate directly on object->functionsAndExpressions once old compiler is gone.
+class QQmlJSCodeGenerator : public QQmlCompilePass
+{
+public:
+ QQmlJSCodeGenerator(QQmlTypeCompiler *typeCompiler, QtQml::JSCodeGen *v4CodeGen);
+
+ bool generateCodeForComponents();
+
+private:
+ bool compileComponent(int componentRoot, const QHash<int, int> &objectIndexToId);
+ bool compileJavaScriptCodeInObjectsRecursively(int objectIndex, int scopeObjectIndex);
+
+ bool isComponent(int objectIndex) const { return objectIndexToIdPerComponent.contains(objectIndex); }
+
+ const QHash<int, QHash<int, int> > &objectIndexToIdPerComponent;
+ const QHash<int, QQmlCompiledData::TypeReference*> &resolvedTypes;
+ const QList<QtQml::QmlObject*> &qmlObjects;
+ const QVector<QQmlPropertyCache *> &propertyCaches;
+ QtQml::JSCodeGen * const v4CodeGen;
};
QT_END_NAMESPACE