aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-20 12:21:21 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-02 14:48:03 +0100
commit1c509a887a177939556514cd7cd389031d05117c (patch)
tree4c3694e329a1f6c7416a15924e5c96347ccde510 /src/qml/compiler
parent8a81380cca802e230011464c9f25c0c1604909d7 (diff)
[new compiler] When resolving names of attached properties, don't report the error at import time
Instead report it later with a more specific error message. This is consistent with the old compiler. Change-Id: Iba345b7ecc8a9ff474938f69118665eb0d965594 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r--src/qml/compiler/qqmlcodegenerator.cpp2
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp3
-rw-r--r--src/qml/compiler/qv4compileddata_p.h4
3 files changed, 6 insertions, 3 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp
index 9f94118a60..45d97d48bd 100644
--- a/src/qml/compiler/qqmlcodegenerator.cpp
+++ b/src/qml/compiler/qqmlcodegenerator.cpp
@@ -1160,6 +1160,7 @@ void QQmlCodeGenerator::collectTypeReferences()
if (obj->inheritedTypeNameIndex != emptyStringIndex) {
QV4::CompiledData::TypeReference &r = _typeReferences.add(obj->inheritedTypeNameIndex, obj->location);
r.needsCreation = true;
+ r.errorWhenNotFound = true;
}
for (const QmlProperty *prop = obj->firstProperty(); prop; prop = prop->next) {
@@ -1168,6 +1169,7 @@ void QQmlCodeGenerator::collectTypeReferences()
// compiler can't and the tests expect it to be the object location right now.
QV4::CompiledData::TypeReference &r = _typeReferences.add(prop->customTypeNameIndex, obj->location);
r.needsCreation = true;
+ r.errorWhenNotFound = true;
}
}
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index abb2f3f5e2..71a7c71dc1 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -468,8 +468,7 @@ bool QQmlPropertyCacheCreator::buildMetaObjectRecursively(int objectIndex, int r
} else if (instantiatingBinding && instantiatingBinding->isAttachedProperty()) {
QQmlCompiledData::TypeReference *typeRef = resolvedTypes->value(instantiatingBinding->propertyNameIndex);
Q_ASSERT(typeRef);
- Q_ASSERT(typeRef->type);
- const QMetaObject *attachedMo = typeRef->type->attachedPropertiesType();
+ const QMetaObject *attachedMo = typeRef->type ? typeRef->type->attachedPropertiesType() : 0;
if (!attachedMo) {
recordError(instantiatingBinding->location, tr("Non-existent attached object"));
return false;
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index 675282fb8c..1f6bdfb2cf 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -80,9 +80,11 @@ struct TypeReference
TypeReference(const Location &loc)
: location(loc)
, needsCreation(false)
+ , errorWhenNotFound(false)
{}
Location location; // first use
- bool needsCreation; // whether the type needs to be creatable or not
+ bool needsCreation : 1; // whether the type needs to be creatable or not
+ bool errorWhenNotFound: 1;
};
// map from name index to location of first use