Ensure we keep the context around for as long as it is needed.

This commit is contained in:
Roberto Raggi
2010-05-31 12:09:28 +02:00
parent e26cf0ab4d
commit 1c078ec2a3
9 changed files with 120 additions and 95 deletions

View File

@@ -56,6 +56,19 @@ FindUsages::FindUsages(Document::Ptr doc, const Snapshot &snapshot)
typeofExpression.init(_doc, _snapshot, _context.bindings());
}
FindUsages::FindUsages(const LookupContext &context)
: ASTVisitor(context.thisDocument()->translationUnit()),
_doc(context.thisDocument()),
_snapshot(context.snapshot()),
_context(context),
_source(_doc->source()),
_sem(_doc->translationUnit()),
_inSimpleDeclaration(0),
_inQProperty(false)
{
typeofExpression.init(_doc, _snapshot, _context.bindings());
}
QList<Usage> FindUsages::usages() const
{ return _usages; }

View File

@@ -60,6 +60,7 @@ class CPLUSPLUS_EXPORT FindUsages: protected ASTVisitor
{
public:
FindUsages(Document::Ptr doc, const Snapshot &snapshot);
FindUsages(const LookupContext &context);
void operator()(Symbol *symbol);