From 55b11db1f7abbabbedaf2a509126ab675170839e Mon Sep 17 00:00:00 2001 From: Christian Kamm <christian.d.kamm@nokia.com> Date: Fri, 24 Jun 2011 09:55:14 +0200 Subject: [PATCH] QmlJS: Fix error location for prototype errors. Change-Id: Iaeb96ff67cfc92bcddeb1b7075b7fdcbaed317c0 Reviewed-on: http://codereview.qt.nokia.com/691 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com> --- src/libs/qmljs/qmljscheck.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index 1639c5dcd0f..b8146540209 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -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())); } -- GitLab