forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.4'
Conflicts: src/libs/qmljs/qmljsinterpreter.cpp src/libs/qmljs/qmljsinterpreter.h src/plugins/debugger/qml/scriptconsole.cpp src/plugins/git/gitplugin.cpp src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas.cpp src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas_p.h Change-Id: Iad59c8d87c72a21c79c047e374c0ab689998af39
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
@@ -26,7 +26,7 @@
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
@@ -1225,12 +1225,6 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
return link;
|
||||
|
||||
const Snapshot &snapshot = m_modelManager->snapshot();
|
||||
Document::Ptr doc = m_lastSemanticInfo.doc;
|
||||
if (!doc) {
|
||||
doc = snapshot.document(file()->fileName());
|
||||
if (!doc)
|
||||
return link;
|
||||
}
|
||||
|
||||
QTextCursor tc = cursor;
|
||||
QChar ch = characterAt(tc.position());
|
||||
@@ -1239,17 +1233,28 @@ CPPEditorWidget::Link CPPEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||
ch = characterAt(tc.position());
|
||||
}
|
||||
|
||||
if (doc->translationUnit() && doc->translationUnit()->ast()) {
|
||||
// Initially try to macth decl/def. For this we need the semantic doc with the AST.
|
||||
if (m_lastSemanticInfo.doc
|
||||
&& m_lastSemanticInfo.doc->translationUnit()
|
||||
&& m_lastSemanticInfo.doc->translationUnit()->ast()) {
|
||||
int pos = tc.position();
|
||||
while (characterAt(pos).isSpace())
|
||||
++pos;
|
||||
if (characterAt(pos) == QLatin1Char('(')) {
|
||||
link = attemptFuncDeclDef(cursor, doc, snapshot);
|
||||
link = attemptFuncDeclDef(cursor, m_lastSemanticInfo.doc, snapshot);
|
||||
if (link.isValid())
|
||||
return link;
|
||||
}
|
||||
}
|
||||
|
||||
// Now we prefer the doc from the snapshot with macros expanded.
|
||||
Document::Ptr doc = snapshot.document(file()->fileName());
|
||||
if (!doc) {
|
||||
doc = m_lastSemanticInfo.doc;
|
||||
if (!doc)
|
||||
return link;
|
||||
}
|
||||
|
||||
int lineNumber = 0, positionInBlock = 0;
|
||||
convertPosition(cursor.position(), &lineNumber, &positionInBlock);
|
||||
const unsigned line = lineNumber;
|
||||
|
||||
Reference in New Issue
Block a user