CompiledFunctionOrExpression *expr = New<CompiledFunctionOrExpression>();
expr->node = statement;
- expr->nameIndex = 0;
+ expr->nameIndex = registerString(QStringLiteral("expression for ") + stringAt(binding->propertyNameIndex));
expr->disableAcceleratedLookups = false;
const int index = bindingsTarget()->functionsAndExpressions->append(expr);
binding->value.compiledScriptIndex = index;
if (!pd->isWritable()
&& !pd->isQList()
- && binding->type != QV4::CompiledData::Binding::Type_GroupProperty
+ && !binding->isGroupProperty()
&& !(binding->flags & QV4::CompiledData::Binding::InitializerForReadOnlyDeclaration)
) {
} else if (binding->type == QV4::CompiledData::Binding::Type_Object) {
if (!validateObjectBinding(pd, name, binding))
return false;
- } else if (binding->type == QV4::CompiledData::Binding::Type_GroupProperty) {
+ } else if (binding->isGroupProperty()) {
if (QQmlValueTypeFactory::isValueType(pd->propType)) {
- if (!QQmlValueTypeFactory::valueType(pd->propType)) {
+ if (QQmlValueTypeFactory::valueType(pd->propType)) {
+ if (!pd->isWritable()) {
+ recordError(binding->location, tr("Invalid property assignment: \"%1\" is a read-only property").arg(name));
+ return false;
+ }
+ } else {
recordError(binding->location, tr("Invalid grouped property access"));
return false;
}