diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-03-05 12:23:19 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-07 12:10:38 +0100 |
commit | 5d8b07bd6ad6550ce6464973c5132580589a96a2 (patch) | |
tree | dee1c5454a0621646b0ea0da4bbf4ef5799b6216 | |
parent | aed15e776277410fb43ce2d2a9a8924359a58653 (diff) |
Don't needlessly create alias property names in the meta-object
When aliases should not be resolved, there is no need to create the
alias name StringRef, since it would occupy space in the meta-data
even though the string was never actually initialized.
Similarly, when aliases should be resolved, it's enough to create the
StringRef once.
Change-Id: I44dfe665fe8d7bd5754bc939ff62ad75efe19d5b
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
-rw-r--r-- | src/qml/qml/ftw/qfastmetabuilder.cpp | 3 | ||||
-rw-r--r-- | src/qml/qml/qqmlcompiler.cpp | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/qml/qml/ftw/qfastmetabuilder.cpp b/src/qml/qml/ftw/qfastmetabuilder.cpp index 02f50911ea..08ea76b37e 100644 --- a/src/qml/qml/ftw/qfastmetabuilder.cpp +++ b/src/qml/qml/ftw/qfastmetabuilder.cpp @@ -197,7 +197,8 @@ void QFastMetaBuilder::setProperty(int index, const StringRef &name, const Strin QMetaType::Type mtype, PropertyFlag flags, int notifySignal) { Q_ASSERT(!m_data.isEmpty()); - Q_ASSERT(!name.isEmpty() && !type.isEmpty()); + Q_ASSERT(!name.isEmpty()); + Q_ASSERT(!type.isEmpty()); QMetaObjectPrivate *p = priv(m_data); Q_ASSERT(index < p->propertyCount); diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp index 23c4adc7b4..1ae8240b62 100644 --- a/src/qml/qml/qqmlcompiler.cpp +++ b/src/qml/qml/qqmlcompiler.cpp @@ -2865,7 +2865,8 @@ bool QQmlCompiler::buildDynamicMeta(QQmlScript::Object *obj, DynamicMetaMode mod for (Object::DynamicProperty *p = obj->dynamicProperties.first(); p; p = obj->dynamicProperties.next(p)) { // Reserve space for name - p->nameRef = builder.newString(p->name.utf8length()); + if (p->type != Object::DynamicProperty::Alias || resolveAlias) + p->nameRef = builder.newString(p->name.utf8length()); int propertyType = 0; bool readonly = false; @@ -3231,6 +3232,8 @@ bool QQmlCompiler::compileAlias(QFastMetaBuilder &builder, int propIndex, int aliasIndex, Object::DynamicProperty &prop) { + Q_ASSERT(!prop.nameRef.isEmpty()); + Q_ASSERT(prop.typeRef.isEmpty()); if (!prop.defaultValue) COMPILE_EXCEPTION(obj, tr("No property alias location")); @@ -3325,7 +3328,6 @@ bool QQmlCompiler::compileAlias(QFastMetaBuilder &builder, VMD *vmd = (QQmlVMEMetaData *)data.data(); *(vmd->aliasData() + aliasIndex) = aliasData; - prop.nameRef = builder.newString(prop.name.utf8length()); prop.resolvedCustomTypeName = pool->NewByteArray(typeName); prop.typeRef = builder.newString(typeName.length()); |