summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cpphoverhandler.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2010-05-05 12:06:38 +0200
committerRoberto Raggi <roberto.raggi@nokia.com>2010-05-05 16:36:46 +0200
commitd9527680a9fbbdb8f70c82143e77a52ef34d61aa (patch)
tree97d8d2e9b92ba1ec1a68bf4ca4cbbca4f1472a00 /src/plugins/cppeditor/cpphoverhandler.cpp
parent66a9ef072535d33b8876ebc873134fac2d6c7e02 (diff)
downloadqt-creator-d9527680a9fbbdb8f70c82143e77a52ef34d61aa.tar.gz
Try to use the new LookupContext.
Diffstat (limited to 'src/plugins/cppeditor/cpphoverhandler.cpp')
-rw-r--r--src/plugins/cppeditor/cpphoverhandler.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp
index 63be4f097f..f38179e09e 100644
--- a/src/plugins/cppeditor/cpphoverhandler.cpp
+++ b/src/plugins/cppeditor/cpphoverhandler.cpp
@@ -180,7 +180,8 @@ static QString buildHelpId(Symbol *symbol, const Name *name)
// ### move me
static FullySpecifiedType resolve(const FullySpecifiedType &ty,
- const DeprecatedLookupContext &context,
+ const LookupContext &context,
+ Symbol *lastVisibleSymbol,
Symbol **resolvedSymbol,
const Name **resolvedName)
{
@@ -188,22 +189,25 @@ static FullySpecifiedType resolve(const FullySpecifiedType &ty,
if (const PointerType *ptrTy = ty->asPointerType()) {
return control->pointerType(resolve(ptrTy->elementType(), context,
+ lastVisibleSymbol,
resolvedSymbol, resolvedName));
} else if (const ReferenceType *refTy = ty->asReferenceType()) {
return control->referenceType(resolve(refTy->elementType(), context,
+ lastVisibleSymbol,
resolvedSymbol, resolvedName));
} else if (const PointerToMemberType *ptrToMemTy = ty->asPointerToMemberType()) {
return control->pointerToMemberType(ptrToMemTy->memberName(),
resolve(ptrToMemTy->elementType(), context,
+ lastVisibleSymbol,
resolvedSymbol, resolvedName));
} else if (const NamedType *namedTy = ty->asNamedType()) {
if (resolvedName)
*resolvedName = namedTy->name();
- const QList<Symbol *> candidates = context.resolve(namedTy->name());
+ const QList<Symbol *> candidates = context.lookup(namedTy->name(), lastVisibleSymbol);
foreach (Symbol *c, candidates) {
if (c->isClass() || c->isEnum()) {
@@ -284,7 +288,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
Symbol *lastSymbol = doc->findSymbolAt(line, column);
TypeOfExpression typeOfExpression;
- typeOfExpression.setSnapshot(documents);
+ typeOfExpression.init(doc, documents);
// We only want to show F1 if the tooltip matches the help id
bool showF1 = true;
@@ -332,7 +336,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
ExpressionUnderCursor expressionUnderCursor;
const QString expression = expressionUnderCursor(tc);
- const QList<LookupItem> types = typeOfExpression(expression, doc, lastSymbol);
+ const QList<LookupItem> types = typeOfExpression(expression, lastSymbol);
if (!types.isEmpty()) {
const LookupItem result = types.first();
@@ -343,6 +347,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
Symbol *resolvedSymbol = lookupSymbol;
const Name *resolvedName = lookupSymbol ? lookupSymbol->name() : 0;
firstType = resolve(firstType, typeOfExpression.lookupContext(),
+ lastSymbol,
&resolvedSymbol, &resolvedName);
if (resolvedSymbol && resolvedSymbol->scope()