Cleanup
authorSimon Hausmann <simon.hausmann@theqtcompany.com>
Wed, 8 Apr 2015 12:09:14 +0000 (14:09 +0200)
committerSimon Hausmann <simon.hausmann@theqtcompany.com>
Tue, 14 Apr 2015 13:07:43 +0000 (13:07 +0000)
Avoid re-using the same variable for different purposes, so just pull in the
first use into the tight scope and the second "property" variable close to
the loop it is used with.

Change-Id: I3a325478f9e56413b65dea9c7e05566497fbc6cf
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/qml/qqmlobjectcreator.cpp

index 9abd1859b76ac3d3cc62026ae70b13d0506e8010..29995e828d612ca0c3528a2ea46df0039c90883b 100644 (file)
@@ -654,7 +654,6 @@ void QQmlObjectCreator::setupBindings(const QBitArray &bindingsToSkip)
     QQmlListProperty<void> savedList;
     qSwap(_currentList, savedList);
 
-    QQmlPropertyData *property = 0;
     QQmlPropertyData *defaultProperty = _compiledObject->indexOfDefaultProperty != -1 ? _propertyCache->parent()->defaultProperty() : _propertyCache->defaultProperty();
 
     QString id = stringAt(_compiledObject->idIndex);
@@ -688,17 +687,17 @@ void QQmlObjectCreator::setupBindings(const QBitArray &bindingsToSkip)
 
                 const QV4::CompiledData::Binding *binding = _compiledObject->bindingTable();
                 for (quint32 i = 0; i < _compiledObject->nBindings; ++i, ++binding) {
-                    property = binding->propertyNameIndex != 0 ? _propertyCache->property(stringAt(binding->propertyNameIndex), _qobject, context) : defaultProperty;
+                    QQmlPropertyData *property = binding->propertyNameIndex != 0 ? _propertyCache->property(stringAt(binding->propertyNameIndex), _qobject, context) : defaultProperty;
                     if (property)
                         bindingSkipList |= (1 << property->coreIndex);
                 }
-                property = 0;
 
                 proxy->removeBindings(bindingSkipList);
             }
         }
     }
 
+    QQmlPropertyData *property = 0;
     const QV4::CompiledData::Binding *binding = _compiledObject->bindingTable();
     for (quint32 i = 0; i < _compiledObject->nBindings; ++i, ++binding) {