aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmlcodegenerator_p.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-10-25 14:23:39 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-31 16:00:58 +0100
commit71338b4b2f01268759f7ac6b3eff5abb17420a7c (patch)
tree9be8f7484e1a70e3d1d52c75f8bcf971448a3d44 /src/qml/compiler/qqmlcodegenerator_p.h
parent76684fd3edcdc8e120c67f82cbd0625bf9bcc0bb (diff)
Resolve member expressions of QObject members
...when the base is a QObject property itself or an ID referenced object. This patch resolves for example the width property in a parent.width expression to be a per-index lookup at run-time. That requires the base ("parent") however to be a final property or come from an object where expected revision is known, i.e. a QML imported object (scope or context). Change-Id: Iaa1f57ace452da5e059c1d4e63b52b316e1a6b08 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qqmlcodegenerator_p.h')
-rw-r--r--src/qml/compiler/qqmlcodegenerator_p.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator_p.h b/src/qml/compiler/qqmlcodegenerator_p.h
index 43bc979205..d077bff6db 100644
--- a/src/qml/compiler/qqmlcodegenerator_p.h
+++ b/src/qml/compiler/qqmlcodegenerator_p.h
@@ -347,13 +347,14 @@ private:
struct Q_QML_EXPORT JSCodeGen : public QQmlJS::Codegen
{
- JSCodeGen(const QString &fileName, const QString &sourceCode, V4IR::Module *jsModule,
+ JSCodeGen(QQmlEnginePrivate *enginePrivate, const QString &fileName, const QString &sourceCode, V4IR::Module *jsModule,
QQmlJS::Engine *jsEngine, AST::UiProgram *qmlRoot, QQmlTypeNameCache *imports);
struct IdMapping
{
QString name;
int idIndex;
+ QQmlPropertyCache *type;
};
typedef QVector<IdMapping> ObjectIdMapping;
@@ -363,10 +364,14 @@ struct Q_QML_EXPORT JSCodeGen : public QQmlJS::Codegen
// Returns mapping from input functions to index in V4IR::Module::functions / compiledData->runtimeFunctions
QVector<int> generateJSCodeForFunctionsAndBindings(const QList<AST::Node*> &functions);
+ // Resolve QObject members with the help of QQmlEngine's meta type registry
+ virtual V4IR::Expr *member(V4IR::Expr *base, const QString *name);
+
protected:
virtual V4IR::Expr *fallbackNameLookup(const QString &name, int line, int col);
private:
+ QQmlEnginePrivate *engine;
QString sourceCode;
QQmlJS::Engine *jsEngine; // needed for memory pool
AST::UiProgram *qmlRoot;