aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmlcodegenerator.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-09-16 14:38:58 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-20 14:26:33 +0200
commit896d63dc10f0ad99d314a3c99f24681feac8aebf (patch)
tree1d2b96a8eabd0db8aeb3e3d5d0d119af4a1412b0 /src/qml/compiler/qqmlcodegenerator.cpp
parentd847bf07a2659a9b1bf022565eca5455f918b50c (diff)
[new compiler] Cleanup attached and group property determination
Determine when a qualified identifier signifies an attached property or a group property in one place and set the Binding::Type accordingly. This simplifies the object builder code, too. Change-Id: I9f572441e9b5b43338752b848649fbd507cabe4c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qqmlcodegenerator.cpp')
-rw-r--r--src/qml/compiler/qqmlcodegenerator.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp
index 2e0ea224c2..3c525668f4 100644
--- a/src/qml/compiler/qqmlcodegenerator.cpp
+++ b/src/qml/compiler/qqmlcodegenerator.cpp
@@ -811,7 +811,11 @@ AST::UiQualifiedId *QQmlCodeGenerator::resolveQualifiedId(AST::UiQualifiedId *na
binding->location.line = name->identifierToken.startLine;
binding->location.column = name->identifierToken.startColumn;
binding->flags = 0;
- binding->type = QV4::CompiledData::Binding::Type_Object;
+
+ if (name->name.unicode()->isUpper())
+ binding->type = QV4::CompiledData::Binding::Type_AttachedProperty;
+ else
+ binding->type = QV4::CompiledData::Binding::Type_GroupProperty;
int objIndex = defineQMLObject(0, 0);
binding->value.objectIndex = objIndex;
@@ -876,11 +880,7 @@ void QQmlCodeGenerator::collectTypeReferences()
_typeReferences.add(param->customTypeNameIndex, param->location);
for (Binding *binding = obj->bindings->first; binding; binding = binding->next) {
- if (binding->type != QV4::CompiledData::Binding::Type_Object)
- continue;
- const QString &propName = stringAt(binding->propertyNameIndex);
- // Attached property?
- if (propName.unicode()->isUpper())
+ if (binding->type == QV4::CompiledData::Binding::Type_AttachedProperty)
_typeReferences.add(binding->propertyNameIndex, binding->location);
}
}
@@ -1108,7 +1108,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio
for (Binding *binding = obj->bindings->first; binding; binding = binding->next) {
QString propertyName = stringAt(binding->propertyNameIndex);
// Attached property?
- if (propertyName.unicode()->isUpper() && binding->type == QV4::CompiledData::Binding::Type_Object) {
+ if (binding->type == QV4::CompiledData::Binding::Type_AttachedProperty) {
QmlObject *attachedObj = parsedQML->objects[binding->value.objectIndex];
QQmlType *type = unit->resolvedTypes.value(binding->propertyNameIndex).type;
QQmlPropertyCache *cache = enginePrivate->cache(type->attachedPropertiesType());