* Make sure to remove earlier set bindings for any value type property, not just
scripts. We want font.bold: false to also override an earlier actual binding
for example.
* Propagate on assignments on qualified property names throughout the
chain of bindings - that makes it easier to detect them early on.
* The group property collection in the bindings validator should only include
value bindings to group properties, not on assignments - as they can always
appear in parallel.
Change-Id: Ib7ec4de755a5a8d269324a77cba36eb945366274
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
{
const QQmlJS::AST::SourceLocation qualifiedNameLocation = name->identifierToken;
QmlObject *object = 0;
- if (!resolveQualifiedId(&name, &object))
+ if (!resolveQualifiedId(&name, &object, isOnAssignment))
return;
qSwap(_object, object);
appendBinding(qualifiedNameLocation, name->identifierToken, registerString(name->name.toString()), objectIndex, /*isListItem*/false, isOnAssignment);
return true;
}
-bool QQmlCodeGenerator::resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, QmlObject **object)
+bool QQmlCodeGenerator::resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, QmlObject **object, bool onAssignment)
{
QQmlJS::AST::UiQualifiedId *qualifiedIdElement = *nameToResolve;
binding->valueLocation.column = qualifiedIdElement->next->identifierToken.startColumn;
binding->flags = 0;
+ if (onAssignment)
+ binding->flags |= QV4::CompiledData::Binding::IsOnAssignment;
+
if (isAttachedProperty)
binding->type = QV4::CompiledData::Binding::Type_AttachedProperty;
else
// resolves qualified name (font.pixelSize for example) and returns the last name along
// with the object any right-hand-side of a binding should apply to.
- bool resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, QmlObject **object);
+ bool resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, QmlObject **object, bool onAssignment = false);
void recordError(const QQmlJS::AST::SourceLocation &location, const QString &description);
if (!binding->isGroupProperty())
continue;
+ if (binding->flags & QV4::CompiledData::Binding::IsOnAssignment)
+ continue;
+
if (populatingValueTypeGroupProperty) {
recordError(binding->location, tr("Property assignment expected"));
return false;
if (!bindingToDefaultProperty
&& !binding->isGroupProperty()
+ && !(binding->flags & QV4::CompiledData::Binding::IsOnAssignment)
&& assigningToGroupProperty) {
QV4::CompiledData::Location loc = binding->valueLocation;
if (loc < (*assignedGroupProperty)->valueLocation)
const QV4::CompiledData::Binding *binding = _compiledObject->bindingTable();
for (quint32 i = 0; i < _compiledObject->nBindings; ++i, ++binding) {
- if (binding->type != QV4::CompiledData::Binding::Type_Script)
- continue;
property = binding->propertyNameIndex != 0 ? _propertyCache->property(stringAt(binding->propertyNameIndex), _qobject, context) : defaultProperty;
if (property)
bindingSkipList |= (1 << property->coreIndex);