Commit 55b11db1 authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Fix error location for prototype errors.

Change-Id: Iaeb96ff67cfc92bcddeb1b7075b7fdcbaed317c0
Reviewed-on: http://codereview.qt.nokia.com/691

Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent 395ba987
......@@ -470,11 +470,12 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
}
bool typeError = false;
const SourceLocation typeErrorLocation = fullLocationForQualifiedId(typeId);
const ObjectValue *prototype = _context.lookupType(_doc.data(), typeId);
if (!prototype) {
typeError = true;
if (_options & ErrCheckTypeErrors)
error(typeId->identifierToken,
error(typeErrorLocation,
Check::tr("unknown type"));
} else {
PrototypeIterator iter(prototype, &_context);
......@@ -486,16 +487,16 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
if (iter.error() == PrototypeIterator::ReferenceResolutionError) {
if (const QmlPrototypeReference *ref =
dynamic_cast<const QmlPrototypeReference *>(lastPrototype->prototype())) {
error(typeId->identifierToken,
error(typeErrorLocation,
Check::tr("could not resolve the prototype %1 of %2").arg(
Bind::toString(ref->qmlTypeName()), lastPrototype->className()));
} else {
error(typeId->identifierToken,
error(typeErrorLocation,
Check::tr("could not resolve the prototype of %1").arg(
lastPrototype->className()));
}
} else if (iter.error() == PrototypeIterator::CycleError) {
error(typeId->identifierToken,
error(typeErrorLocation,
Check::tr("prototype cycle, the last non-repeated object is %1").arg(
lastPrototype->className()));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment