aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmltypecompiler.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-03 13:30:06 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-04 18:28:25 +0100
commite5bd40742ab8d0b4ffc9307eb46bc41456fe394a (patch)
treec14979f7f451e90988714450607234059fa5d022 /src/qml/compiler/qqmltypecompiler.cpp
parent48144d3b29a1204bf1820d782228fbd9e25f318e (diff)
[new compiler] Cleanup empty string handling
Ensure that the empty string always has index 0, that simplifies the code in a few places and makes it easier to check for the empty string in other places where there's no access to the string pool itself. Change-Id: Icd204aec478e8350ef3fee75d89bda1f88cffe26 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qqmltypecompiler.cpp')
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index 41dcd669a3..6197ddf5d0 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -397,7 +397,7 @@ bool QQmlPropertyCacheCreator::buildMetaObjectRecursively(int objectIndex, int r
Q_ASSERT(referencingObjectIndex >= 0);
QQmlPropertyCache *parentCache = propertyCaches.at(referencingObjectIndex);
Q_ASSERT(parentCache);
- Q_ASSERT(!stringAt(instantiatingBinding->propertyNameIndex).isEmpty());
+ Q_ASSERT(instantiatingBinding->propertyNameIndex != 0);
bool notInRevision = false;
instantiatingProperty = PropertyResolver(parentCache).property(stringAt(instantiatingBinding->propertyNameIndex), &notInRevision);
@@ -434,8 +434,7 @@ bool QQmlPropertyCacheCreator::buildMetaObjectRecursively(int objectIndex, int r
}
}
- QString typeName = stringAt(obj->inheritedTypeNameIndex);
- if (!typeName.isEmpty()) {
+ if (obj->inheritedTypeNameIndex != 0) {
QQmlCompiledData::TypeReference *typeRef = resolvedTypes->value(obj->inheritedTypeNameIndex);
Q_ASSERT(typeRef);
baseTypeCache = typeRef->createPropertyCache(QQmlEnginePrivate::get(enginePrivate));
@@ -1004,10 +1003,9 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QtQm
continue;
QQmlPropertyData *pd = 0;
- QString propertyName = stringAt(binding->propertyNameIndex);
- if (!propertyName.isEmpty()) {
+ if (binding->propertyNameIndex != 0) {
bool notInRevision = false;
- pd = propertyResolver.property(propertyName, &notInRevision);
+ pd = propertyResolver.property(stringAt(binding->propertyNameIndex), &notInRevision);
} else {
pd = defaultProperty;
}
@@ -1045,7 +1043,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QtQm
QtQml::Binding *syntheticBinding = pool->New<QtQml::Binding>();
*syntheticBinding = *binding;
syntheticBinding->type = QV4::CompiledData::Binding::Type_Object;
- QString error = syntheticComponent->appendBinding(syntheticBinding, /*isListBinding*/false, /*bindingToDefaultProperty*/false);
+ QString error = syntheticComponent->appendBinding(syntheticBinding, /*isListBinding*/false);
Q_ASSERT(error.isEmpty());
Q_UNUSED(error);
@@ -1065,7 +1063,7 @@ bool QQmlComponentAndAliasResolver::resolve()
const int objCountWithoutSynthesizedComponents = qmlObjects->count();
for (int i = 0; i < objCountWithoutSynthesizedComponents; ++i) {
const QtQml::QmlObject *obj = qmlObjects->at(i);
- if (stringAt(obj->inheritedTypeNameIndex).isEmpty())
+ if (obj->inheritedTypeNameIndex == 0)
continue;
QQmlCompiledData::TypeReference *tref = resolvedTypes->value(obj->inheritedTypeNameIndex);
@@ -1131,8 +1129,7 @@ bool QQmlComponentAndAliasResolver::collectIdsAndAliases(int objectIndex)
{
const QtQml::QmlObject *obj = qmlObjects->at(objectIndex);
- QString id = stringAt(obj->idIndex);
- if (!id.isEmpty()) {
+ if (obj->idIndex != 0) {
if (_idToObjectIndex.contains(obj->idIndex)) {
recordError(obj->locationOfIdProperty, tr("id is not unique"));
return false;