Commit afedec33 authored by Roberto Raggi's avatar Roberto Raggi

Run the binder before searching strong and weak references.

parent f19ce6c2
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include <Scope.h> #include <Scope.h>
#include <cplusplus/CppDocument.h> #include <cplusplus/CppDocument.h>
#include <cplusplus/CppBindings.h>
#include <cplusplus/ExpressionUnderCursor.h> #include <cplusplus/ExpressionUnderCursor.h>
#include <cplusplus/ResolveExpression.h> #include <cplusplus/ResolveExpression.h>
#include <cplusplus/Overview.h> #include <cplusplus/Overview.h>
...@@ -81,6 +82,11 @@ public: ...@@ -81,6 +82,11 @@ public:
_snapshot.insert(_doc); _snapshot.insert(_doc);
} }
void setGlobalNamespaceBinding(NamespaceBindingPtr globalNamespaceBinding)
{
_globalNamespaceBinding = globalNamespaceBinding;
}
QList<int> operator()(Symbol *symbol, Identifier *id, AST *ast) QList<int> operator()(Symbol *symbol, Identifier *id, AST *ast)
{ {
_references.clear(); _references.clear();
...@@ -419,6 +425,7 @@ private: ...@@ -419,6 +425,7 @@ private:
QByteArray _source; QByteArray _source;
Document::Ptr _exprDoc; Document::Ptr _exprDoc;
Semantic _sem; Semantic _sem;
NamespaceBindingPtr _globalNamespaceBinding;
QList<PostfixExpressionAST *> _postfixExpressionStack; QList<PostfixExpressionAST *> _postfixExpressionStack;
QList<QualifiedNameAST *> _qualifiedNameStack; QList<QualifiedNameAST *> _qualifiedNameStack;
QList<int> _references; QList<int> _references;
...@@ -456,6 +463,7 @@ QList<int> CppFindReferences::references(Symbol *symbol, ...@@ -456,6 +463,7 @@ QList<int> CppFindReferences::references(Symbol *symbol,
Q_ASSERT(translationUnit != 0); Q_ASSERT(translationUnit != 0);
Process process(doc, snapshot, /*future = */ 0); Process process(doc, snapshot, /*future = */ 0);
process.setGlobalNamespaceBinding(bind(doc, snapshot));
references = process(symbol, id, translationUnit->ast()); references = process(symbol, id, translationUnit->ast());
return references; return references;
...@@ -542,6 +550,7 @@ static void find_helper(QFutureInterface<Utils::FileSearchResult> &future, ...@@ -542,6 +550,7 @@ static void find_helper(QFutureInterface<Utils::FileSearchResult> &future,
tm.start(); tm.start();
Process process(doc, snapshot, &future); Process process(doc, snapshot, &future);
process.setGlobalNamespaceBinding(bind(doc, snapshot));
TranslationUnit *unit = doc->translationUnit(); TranslationUnit *unit = doc->translationUnit();
process(symbol, id, unit->ast()); process(symbol, id, unit->ast());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment