diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-05-30 13:23:28 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-01 09:35:09 +0200 |
commit | d38f4cea6b4255e9b4e59212ebfecb50c4a1ba4b (patch) | |
tree | 7d37b42d4dea8890fb47b6c0eb04a16c3ba582d8 /src/qml/qml/qqmlcompiler.cpp | |
parent | 6cb34bd5000b68d04b2798f6aa16134464573420 (diff) |
Avoid copy-and-paste of property cache resolution code
Change-Id: I0f3d8c1641c7c277ef62af7d4f81437e44ac0bad
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlcompiler.cpp')
-rw-r--r-- | src/qml/qml/qqmlcompiler.cpp | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp index 6e2799547b..f8625861af 100644 --- a/src/qml/qml/qqmlcompiler.cpp +++ b/src/qml/qml/qqmlcompiler.cpp @@ -3758,17 +3758,21 @@ QStringList QQmlCompiler::deferredProperties(QQmlScript::Object *obj) return rv; } +QQmlPropertyCache * +QQmlCompiler::propertyCacheForObject(QQmlScript::Object *object) + { + if (object->synthCache) + return object->synthCache; + else if (object->type != -1) + return output->types[object->type].createPropertyCache(engine); + else + return object->metatype; +} + QQmlPropertyData * QQmlCompiler::property(QQmlScript::Object *object, int index) { - QQmlPropertyCache *cache = 0; - - if (object->synthCache) - cache = object->synthCache; - else if (object->type != -1) - cache = output->types[object->type].createPropertyCache(engine); - else - cache = object->metatype; + QQmlPropertyCache *cache = propertyCacheForObject(object); return cache->property(index); } @@ -3778,14 +3782,7 @@ QQmlCompiler::property(QQmlScript::Object *object, const QHashedStringRef &name, { if (notInRevision) *notInRevision = false; - QQmlPropertyCache *cache = 0; - - if (object->synthCache) - cache = object->synthCache; - else if (object->type != -1) - cache = output->types[object->type].createPropertyCache(engine); - else - cache = object->metatype; + QQmlPropertyCache *cache = propertyCacheForObject(object); QQmlPropertyData *d = cache->property(name); @@ -3807,14 +3804,7 @@ QQmlCompiler::signal(QQmlScript::Object *object, const QHashedStringRef &name, b { if (notInRevision) *notInRevision = false; - QQmlPropertyCache *cache = 0; - - if (object->synthCache) - cache = object->synthCache; - else if (object->type != -1) - cache = output->types[object->type].createPropertyCache(engine); - else - cache = object->metatype; + QQmlPropertyCache *cache = propertyCacheForObject(object); QQmlPropertyData *d = cache->property(name); |