QmlJSInspector: Remove dependency on QmlJSTools

As Location information is already cached, there is no
need to fetch the information from the QmlJS Semantic info.

Task-number: QTCREATORBUG-7409
Change-Id: I9cc3dce0910632cfe517f7697d74691e6675793b
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
This commit is contained in:
Aurindam Jana
2012-05-25 17:43:56 +02:00
parent 012281cdf8
commit 799fc18bd7
8 changed files with 64 additions and 76 deletions

View File

@@ -110,7 +110,7 @@ void QmlInspectorAgent::updateWatchData(const WatchData &data)
}
}
void QmlInspectorAgent::selectObjectInTree(int debugId)
bool QmlInspectorAgent::selectObjectInTree(int debugId)
{
if (debug) {
qDebug() << __FUNCTION__ << "(" << debugId << ")";
@@ -125,10 +125,12 @@ void QmlInspectorAgent::selectObjectInTree(int debugId)
qDebug() << " selecting" << iname << "in tree";
m_debuggerEngine->watchHandler()->setCurrentItem(iname);
m_objectToSelect = 0;
return true;
} else {
// we've to fetch it
m_objectToSelect = debugId;
fetchObject(debugId);
return false;
}
}
@@ -220,7 +222,7 @@ quint32 QmlInspectorAgent::resetBindingForObject(int objectDebugId,
return queryId;
}
ObjectReference QmlInspectorAgent::objectForId(
ObjectReference QmlInspectorAgent::objectForName(
const QString &objectId) const
{
if (!objectId.isEmpty() && objectId[0].isLower()) {
@@ -234,6 +236,36 @@ ObjectReference QmlInspectorAgent::objectForId(
return ObjectReference();
}
ObjectReference QmlInspectorAgent::objectForId(int objectDebugId) const
{
if (!m_debugIdToIname.contains(objectDebugId))
return ObjectReference(objectDebugId);
int line = -1;
int column = -1;
QString file;
QHashIterator<QPair<QString, int>, QHash<QPair<int, int>, QList<int> > > iter(m_debugIdHash);
while (iter.hasNext()) {
iter.next();
QHashIterator<QPair<int, int>, QList<int> > i(iter.value());
while (i.hasNext()) {
i.next();
if (i.value().contains(objectDebugId)) {
line = i.key().first;
column = i.key().second;
break;
}
}
if (line != -1) {
file = iter.key().first;
break;
}
}
// TODO: Set correct parentId
return ObjectReference(objectDebugId, -1,
FileReference(QUrl::fromLocalFile(file), line, column));
}
int QmlInspectorAgent::objectIdForLocation(
int line, int column) const
{