summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cpphoverhandler.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2010-05-12 12:53:16 +0200
committerRoberto Raggi <roberto.raggi@nokia.com>2010-05-14 13:55:21 +0200
commit60f76c96e8cf9b751e6250a9f80d2517adaf7a5b (patch)
tree098e360e59bf66ca8688582da8896a576554a531 /src/plugins/cppeditor/cpphoverhandler.cpp
parent140756eef42f4b580c9aecac33c2284d3937bf9f (diff)
downloadqt-creator-60f76c96e8cf9b751e6250a9f80d2517adaf7a5b.tar.gz
Improved LookupItem and get rid of some deprecated code.
Diffstat (limited to 'src/plugins/cppeditor/cpphoverhandler.cpp')
-rw-r--r--src/plugins/cppeditor/cpphoverhandler.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp
index f38179e09e..04545161ad 100644
--- a/src/plugins/cppeditor/cpphoverhandler.cpp
+++ b/src/plugins/cppeditor/cpphoverhandler.cpp
@@ -178,6 +178,9 @@ static QString buildHelpId(Symbol *symbol, const Name *name)
return qualifiedNames.join(QLatin1String("::"));
}
+#warning implement static FullySpecifiedType resolve()
+
+#if 0
// ### move me
static FullySpecifiedType resolve(const FullySpecifiedType &ty,
const LookupContext &context,
@@ -257,6 +260,7 @@ static FullySpecifiedType resolve(const FullySpecifiedType &ty,
return ty;
}
+#endif
void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int pos)
{
@@ -270,6 +274,8 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
if (!edit)
return;
+#warning void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int pos)
+#if 0
const Snapshot documents = m_modelManager->snapshot();
const QString fileName = editor->file()->fileName();
Document::Ptr doc = documents.document(fileName);
@@ -285,7 +291,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
// Find the last symbol up to the cursor position
int line = 0, column = 0;
editor->convertPosition(tc.position(), &line, &column);
- Symbol *lastSymbol = doc->findSymbolAt(line, column);
+ Scope *scope = doc->scopeAt(line, column);
TypeOfExpression typeOfExpression;
typeOfExpression.init(doc, documents);
@@ -336,18 +342,18 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
ExpressionUnderCursor expressionUnderCursor;
const QString expression = expressionUnderCursor(tc);
- const QList<LookupItem> types = typeOfExpression(expression, lastSymbol);
+ const QList<LookupItem> types = typeOfExpression(expression, scope);
if (!types.isEmpty()) {
const LookupItem result = types.first();
FullySpecifiedType firstType = result.type(); // result of `type of expression'.
- Symbol *lookupSymbol = result.lastVisibleSymbol(); // lookup symbol
+ Symbol *lookupSymbol = result.declaration(); // lookup symbol
Symbol *resolvedSymbol = lookupSymbol;
const Name *resolvedName = lookupSymbol ? lookupSymbol->name() : 0;
firstType = resolve(firstType, typeOfExpression.lookupContext(),
- lastSymbol,
+ scope,
&resolvedSymbol, &resolvedName);
if (resolvedSymbol && resolvedSymbol->scope()
@@ -362,7 +368,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
m_helpId = buildHelpId(resolvedSymbol, resolvedName);
if (m_toolTip.isEmpty()) {
- Symbol *symbol = result.lastVisibleSymbol();
+ Symbol *symbol = result.declaration();
if (resolvedSymbol)
symbol = resolvedSymbol;
@@ -431,4 +437,5 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
} else if (!m_toolTip.isEmpty() && Qt::mightBeRichText(m_toolTip)) {
m_toolTip = QString(QLatin1String("<nobr>%1")).arg(Qt::escape(m_toolTip));
}
+#endif
}