summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativecompiler.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-03-04 06:04:15 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-03-04 06:04:59 (GMT)
commit57d68b06c15f8426c25e357f97b9154056969e0f (patch)
treecdd224b86ea9bbead3f92563aadae34285885db6 /src/declarative/qml/qdeclarativecompiler.cpp
parent5599ddd113fe1385e7a6aff708e12af419b8de87 (diff)
downloadQt-57d68b06c15f8426c25e357f97b9154056969e0f.zip
Qt-57d68b06c15f8426c25e357f97b9154056969e0f.tar.gz
Qt-57d68b06c15f8426c25e357f97b9154056969e0f.tar.bz2
Improve grouped property error messages
QT-2579
Diffstat (limited to 'src/declarative/qml/qdeclarativecompiler.cpp')
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index 7a3dde9..32c746f 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -1789,13 +1789,19 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr
Q_ASSERT(prop->type != 0);
Q_ASSERT(prop->index != -1);
- if (prop->values.count())
- COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QDeclarativeCompiler", "Invalid value in grouped property"));
-
if (QDeclarativeValueTypeFactory::isValueType(prop->type)) {
QDeclarativeEnginePrivate *ep =
static_cast<QDeclarativeEnginePrivate *>(QObjectPrivate::get(engine));
if (prop->type >= 0 /* QVariant == -1 */ && ep->valueTypes[prop->type]) {
+
+ if (prop->values.count()) {
+ if (prop->values.at(0)->location < prop->value->location) {
+ COMPILE_EXCEPTION(prop->value, QCoreApplication::translate("QDeclarativeCompiler", "Property has already been assigned a value"));
+ } else {
+ COMPILE_EXCEPTION(prop->values.at(0), QCoreApplication::translate("QDeclarativeCompiler", "Property has already been assigned a value"));
+ }
+ }
+
COMPILE_CHECK(buildValueTypeProperty(ep->valueTypes[prop->type],
prop->value, obj, ctxt.incr()));
obj->addValueTypeProperty(prop);
@@ -1810,6 +1816,9 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr
if (!prop->value->metatype)
COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid grouped property access"));
+ if (prop->values.count())
+ COMPILE_EXCEPTION(prop->values.at(0), QCoreApplication::translate("QDeclarativeCompiler", "Cannot assign a value directly to a grouped property"));
+
obj->addGroupedProperty(prop);
COMPILE_CHECK(buildSubObject(prop->value, ctxt.incr()));