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>
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) {
// 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;
}
}
} 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;
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
TypeReference ref; // resolved reference
+ const bool reportErrors = unresolvedRef->errorWhenNotFound;
+
int majorVersion = -1;
int minorVersion = -1;
QQmlImportNamespace *typeNamespace = 0;
}
}
- if (!typeFound || typeNamespace) {
+ if ((!typeFound || typeNamespace) && reportErrors) {
// Known to not be a type:
// - known to be a namespace (Namespace {})
// - type with unknown namespace (UnknownNamespace.SomeType {})
return;
}
- if (ref.type->isComposite()) {
+ if (ref.type && ref.type->isComposite()) {
ref.typeData = typeLoader()->getType(ref.type->sourceUrl());
addDependency(ref.typeData);
}