aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmltypecompiler.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-19 13:08:34 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-02 11:46:22 +0100
commitea8fe81141cd19de9eb006153d0939fb4483984e (patch)
tree905b272ae38092db41c0baac7fe83f675d22168d /src/qml/compiler/qqmltypecompiler.cpp
parentfe5a3a024ac7e5f0cfa89d58c89ac705940bd5a4 (diff)
[new compiler] Fix error reporting for invalid component specifications
Change-Id: I435845ab1188e65a7ef019d758fbbba57e2e0bec Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qqmltypecompiler.cpp')
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index 868c80b47f..fc45d6ce06 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -1143,8 +1143,14 @@ bool QQmlComponentAndAliasResolver::resolve()
COMPILE_EXCEPTION(obj, tr("Cannot create empty component specification"));
const QtQml::Binding *rootBinding = obj->firstBinding();
+
+ for (const QtQml::Binding *b = rootBinding; b; b = b->next) {
+ if (b->propertyNameIndex != 0)
+ COMPILE_EXCEPTION(rootBinding, tr("Component elements may not contain properties other than id"));
+ }
+
if (rootBinding->next || rootBinding->type != QV4::CompiledData::Binding::Type_Object)
- COMPILE_EXCEPTION(rootBinding, tr("Component elements may not contain properties other than id"));
+ COMPILE_EXCEPTION(obj, tr("Invalid component body specification"));
componentBoundaries.append(rootBinding->value.objectIndex);
}