aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp12
-rw-r--r--src/qml/qml/qqmlcompiler.cpp1
-rw-r--r--src/qml/qml/qqmlinstruction_p.h1
-rw-r--r--src/qml/qml/qqmlvme.cpp13
-rw-r--r--tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.errors.txt2
-rw-r--r--tests/auto/qml/qqmllanguage/data/nullDotProperty.errors.txt2
6 files changed, 28 insertions, 3 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index a6b07410ed..090b4c06cb 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -1531,6 +1531,18 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
} 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) {
+ if (QQmlValueTypeFactory::isValueType(pd->propType)) {
+ if (!QQmlValueTypeFactory::valueType(pd->propType)) {
+ recordError(binding->location, tr("Invalid grouped property access"));
+ return false;
+ }
+ } else {
+ if (!enginePrivate->propertyCacheForType(pd->propType)) {
+ recordError(binding->location, tr("Invalid grouped property access"));
+ return false;
+ }
+ }
}
} else {
if (customParser) {
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp
index 9262e2a119..c71c7432a8 100644
--- a/src/qml/qml/qqmlcompiler.cpp
+++ b/src/qml/qml/qqmlcompiler.cpp
@@ -1379,6 +1379,7 @@ void QQmlCompiler::genObjectBody(QQmlScript::Object *obj)
Instruction::FetchObject fetch;
fetch.property = prop->index;
fetch.line = prop->location.start.line;
+ fetch.column = prop->location.start.column;
output->addInstruction(fetch);
if (!prop->value->synthdata.isEmpty()) {
diff --git a/src/qml/qml/qqmlinstruction_p.h b/src/qml/qml/qqmlinstruction_p.h
index d76c9f9f64..314debc8ee 100644
--- a/src/qml/qml/qqmlinstruction_p.h
+++ b/src/qml/qml/qqmlinstruction_p.h
@@ -253,6 +253,7 @@ union QQmlInstruction
QML_INSTR_HEADER
int property;
ushort line;
+ ushort column;
};
struct instr_fetchValue {
QML_INSTR_HEADER
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index e60010ade8..ce4997fef9 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -92,6 +92,17 @@ using namespace QQmlVMETypes;
goto exceptionExit; \
}
+#define VME_EXCEPTION_WITH_COLUMN(desc, line, column) \
+ { \
+ QQmlError error; \
+ error.setDescription(desc.trimmed()); \
+ error.setLine(line); \
+ error.setColumn(column); \
+ error.setUrl(COMP->url); \
+ *errors << error; \
+ goto exceptionExit; \
+ }
+
bool QQmlVME::s_enableComponentComplete = true;
void QQmlVME::init(QQmlContextData *ctxt, QQmlCompiledData *comp, int start,
@@ -992,7 +1003,7 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
instr.property, a);
if (!obj)
- VME_EXCEPTION(tr("Cannot set properties on %1 as it is null").arg(QString::fromUtf8(target->metaObject()->property(instr.property).name())), instr.line);
+ VME_EXCEPTION_WITH_COLUMN(tr("Cannot set properties on %1 as it is null").arg(QString::fromUtf8(target->metaObject()->property(instr.property).name())), instr.line, instr.column);
objects.push(obj);
qmlBindingWrappers[objects.count() - 1] = QV4::Primitive::undefinedValue();
diff --git a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.errors.txt b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.errors.txt
index 4a7e3830a8..0f42a4b39d 100644
--- a/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.errors.txt
+++ b/tests/auto/qml/qqmllanguage/data/invalidGroupedProperty.7.errors.txt
@@ -1 +1 @@
-4:-1:Cannot set properties on nullGrouped as it is null
+4:5:Cannot set properties on nullGrouped as it is null
diff --git a/tests/auto/qml/qqmllanguage/data/nullDotProperty.errors.txt b/tests/auto/qml/qqmllanguage/data/nullDotProperty.errors.txt
index 07a40949cd..581d34e0c3 100644
--- a/tests/auto/qml/qqmllanguage/data/nullDotProperty.errors.txt
+++ b/tests/auto/qml/qqmllanguage/data/nullDotProperty.errors.txt
@@ -1 +1 @@
-3:-1:Cannot set properties on obj as it is null
+3:5:Cannot set properties on obj as it is null