diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-09-30 09:41:35 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-30 18:23:17 +0200 |
commit | 23793482e9b187441203fb629b459245c504dfba (patch) | |
tree | 193d26239f7235ed2d0926f63b97b5b532c3b48b /src/qml/qml | |
parent | 7df73c27121149c36a6c8a21850d85728ea79ad5 (diff) |
Fix invalid alias error reporting in new compiler
Match exactly the VME code path by reporting the right type of error
as well as the right hand side of the alias binding if necessary.
Change-Id: I35d192a20641e0acbf25d20f3dc5fb53cc7cbae5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 1882d359ff..e41248b4ca 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -1552,8 +1552,10 @@ bool QQmlComponentAndAliasResolver::resolveAliases() const int idIndex = p->aliasIdValueIndex; const int targetObjectIndex = _idToObjectIndex.value(idIndex, -1); - if (targetObjectIndex == -1) - COMPILE_EXCEPTION(p, tr("Invalid alias reference. Unable to find id \"%1\"").arg(stringAt(idIndex))); + if (targetObjectIndex == -1) { + recordError(p->aliasLocation, tr("Invalid alias reference. Unable to find id \"%1\"").arg(stringAt(idIndex))); + return false; + } const int targetId = _objectIndexToIdInScope->value(targetObjectIndex, -1); Q_ASSERT(targetId != -1); @@ -1596,8 +1598,10 @@ bool QQmlComponentAndAliasResolver::resolveAliases() QtQml::PropertyResolver resolver(targetCache); QQmlPropertyData *targetProperty = resolver.property(property.toString()); - if (!targetProperty || targetProperty->coreIndex > 0x0000FFFF) - COMPILE_EXCEPTION(p, tr("Invalid alias location")); + if (!targetProperty || targetProperty->coreIndex > 0x0000FFFF) { + recordError(p->aliasLocation, tr("Invalid alias location")); + return false; + } propIdx = targetProperty->coreIndex; type = targetProperty->propType; @@ -1608,15 +1612,19 @@ bool QQmlComponentAndAliasResolver::resolveAliases() if (!subProperty.isEmpty()) { QQmlValueType *valueType = QQmlValueTypeFactory::valueType(type); - if (!valueType) - COMPILE_EXCEPTION(p, tr("Invalid alias location")); + if (!valueType) { + recordError(p->aliasLocation, tr("Invalid alias location")); + return false; + } propType = type; int valueTypeIndex = valueType->metaObject()->indexOfProperty(subProperty.toString().toUtf8().constData()); - if (valueTypeIndex == -1) - COMPILE_EXCEPTION(p, tr("Invalid alias location")); + if (valueTypeIndex == -1) { + recordError(p->aliasLocation, tr("Invalid alias location")); + return false; + } Q_ASSERT(valueTypeIndex <= 0x0000FFFF); propIdx |= (valueTypeIndex << 16); |