diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-06-22 13:35:59 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-06-29 08:31:42 +0000 |
commit | e049377f366dad8f42a3a632be5b347b7f7b4af2 (patch) | |
tree | 29f00126f0e066059dc408d5b0aa6e2e62b42082 /src/qml/compiler/qqmlirbuilder.cpp | |
parent | 971c06eb5be7a671fbfe73eec24fd85a1038f5d4 (diff) |
Fix bugs in qqmlirbuilder
Correctly add the scope and context object dependencies,
and pass the correct index into LoadIdObject.
Change-Id: Idc0d5b229fca40dad6a0ecd4988b4f150db4c0a2
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/compiler/qqmlirbuilder.cpp')
-rw-r--r-- | src/qml/compiler/qqmlirbuilder.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index 1816d6708c..f8165b2acd 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -1654,18 +1654,18 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil } #ifndef V4_BOOTSTRAP -int JSCodeGen::lookupQmlCompliantProperty(QQmlPropertyCache *cache, const QString &name) +QQmlPropertyData *JSCodeGen::lookupQmlCompliantProperty(QQmlPropertyCache *cache, const QString &name) { QQmlPropertyData *pd = cache->property(name, /*object*/0, /*context*/0); // Q_INVOKABLEs can't be FINAL, so we have to look them up at run-time if (!pd || pd->isFunction()) - return -1; + return 0; if (!cache->isAllowedInRevision(pd)) - return -1; + return 0; - return pd->coreIndex(); + return pd; } enum MetaObjectResolverFlags { @@ -1967,7 +1967,7 @@ QQmlJS::Codegen::Reference JSCodeGen::fallbackNameLookup(const QString &name) Reference result = Reference::fromTemp(this); Instruction::LoadIdObject load; load.base = Reference::fromTemp(this, _qmlContextTemp).asRValue(); - load.index = registerString(name); + load.index = mapping.idIndex; load.result = result.asLValue(); bytecodeGenerator->addInstruction(load); @@ -2026,8 +2026,8 @@ QQmlJS::Codegen::Reference JSCodeGen::fallbackNameLookup(const QString &name) } if (_scopeObject) { - int qmlIndex = lookupQmlCompliantProperty(_scopeObject, name); - if (qmlIndex < 0) + QQmlPropertyData *data = lookupQmlCompliantProperty(_scopeObject, name); + if (!data) return Reference::fromName(this, name); #if 0 QV4::IR::Temp *base = _block->TEMP(_qmlContextTemp); @@ -2035,13 +2035,14 @@ QQmlJS::Codegen::Reference JSCodeGen::fallbackNameLookup(const QString &name) base->memberResolver->owner = _function; initMetaObjectResolver(base->memberResolver, _scopeObject); #endif + _function->scopeObjectPropertyDependencies.insert(data->coreIndex(), data->notifyIndex()); Reference base = Reference::fromTemp(this, _qmlContextTemp); - return Reference::fromQmlScopeObject(base, qmlIndex); + return Reference::fromQmlScopeObject(base, data->coreIndex()); } if (_contextObject) { - int qmlIndex = lookupQmlCompliantProperty(_contextObject, name); - if (qmlIndex < 0) + QQmlPropertyData *data = lookupQmlCompliantProperty(_contextObject, name); + if (!data) return Reference::fromName(this, name); #if 0 QV4::IR::Temp *base = _block->TEMP(_qmlContextTemp); @@ -2049,8 +2050,9 @@ QQmlJS::Codegen::Reference JSCodeGen::fallbackNameLookup(const QString &name) base->memberResolver->owner = _function; initMetaObjectResolver(base->memberResolver, _contextObject); #endif + _function->contextObjectPropertyDependencies.insert(data->coreIndex(), data->notifyIndex()); Reference base = Reference::fromTemp(this, _qmlContextTemp); - return Reference::fromQmlContextObject(base, qmlIndex); + return Reference::fromQmlContextObject(base, data->coreIndex()); } #else Q_UNUSED(name) |